- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2022 08:49 PM
HI Team,
I am using the below script in Flow designer and it works fine .
Could you please let me know if it is best practice to use sys_id of a record directly in flow designer script.
If not please let me know the alternatives we can use.
Thank you
var var1 = fd_data._2__get_catalog_variables.<variable name>;
var assignmentgroup = "";
if(var1=='X')
{
assignmentgroup='<sys_id of XYZ>';
}
else if(var1=='Y')
{
assignmentgroup='<sys_id of ABC>';
}
return assignmentgroup;
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2022 09:28 PM
Hi,
Is there a need to use scripts ? Can't data pills be used to compare the catalog variable with assignment group references directly ? That way you don't have to hard code sys_ids.
Thanks,
Arav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2022 01:15 AM
Hello Uttam,
Could you please share the screenshot of flow designer what error you are getting when using the gs.getProperty()
THanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2022 09:03 PM
it should work fine. it's server side and gs.getProperty() should work there.
Share the script and screenshots
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2022 12:49 AM
Hi,
As Ankur mentioned it is not good to use the static values in Flow and use system properties.
I knew that system properties will not work to get system properties in flow.
Please refer below article
https://community.servicenow.com/community?id=community_article&sys_id=4725e2941b830150a59033f2cd4bcbd0
Hope you it helps you.
Please Mark ✅ Correct/helpful if applicable, Thanks!!
Regards
Pavankumar
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2022 12:55 AM
Hello there,
You can store the sys_id's of assignment groups in the system properties. Make sure type is string in system property. And use them in flow by calling as below:
gs.getProperty('property name of respective assignment group');