Flow Designer - How to create a run Script inside of flow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2023 11:12 AM
Currently in our workflows we have the following type of script
current.configuration_item = getCI();
current.u_security_role = getCI();
current.u_application = current.cat_item.u_application;
function getCI()
{
var ci = new GlideRecord('u_cmdb_ci_appl_sec_roles');
ci.addQuery('name',current.variables.role);
ci.query();
if(ci.next())
{
return ci.sys_id;
}
}
- This gets the "CI" based on a Role Variable and update the CI field on the RITM. We use the field for approvals etc. I for the life of me can't figure out how to replicate this process in Flow Designer. I have the AD groups hard coded on that CI record and right now we have 2k CI's with AD fields. So i want to be able to use those. Any ideas? TIA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2023 06:08 PM
Wendy,
Are you sure that script does what you want it to do? It sets both the configuration_item and u_security_role fields to the same value, the sys_id of the last (pretty sure last) record the query finds.
Not sure what that script is supposed to do but I think you want to do a record lookup then use data from that record for something? No need to run a script for that you can use the Lookup Record or Lookup Records actions and access the record values from data pills.
@Uncle Rob aka The Duke has a series of YouTube videos on Flow Designer you should definitely check out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2023 10:55 PM
Hello @Wendy Peterson
Do a lookup record on the "u_cmdb_ci_appl_sec_roles" and use an update record action to update the configuration it and roles.
See the screenshots
In the below step select the catalog item and select the variables which you will using in the flow
Next: DO a lookup on the table and build the condition
Next: Update the lookup records by making use of add fields
Let me know if you need some more details.
Abhit