how to write script into flow design
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2024 11:46 PM
Hi, My requirements are if request type is A, assign it to admin assignment group. if it is B, then the assignment group export group. how to write this script into Flow design. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2024 11:55 PM
You don't need to write a script in Flow Designer for that, just use if - then.
-j0unss
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2024 12:13 AM
It really depends on how your flow is setup, but if it's without any logic/variables and a simple 'set assignment group', you could do it like this (but also check out on AWA/assignment rules).
var assGrp = '';
var reqType = fd_data.trigger.current.your_field; // find the request type field on your trigger or other step
if(reqType = 'A'){ // check if you need to set values or sys id's or anything else, depending on how your variable reqType is set
assGrp = 'sys_id_of_your_group';
} else if (reqType = 'B'){
assGrp = 'sys_id_of_your_other_group';
}
return assGrp;
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2024 12:15 AM
@BanuMahalakshmi If this is just about the request assignment on the basis of the request type then you can do it via the Assignment rule https://docs.servicenow.com/bundle/washingtondc-platform-administration/page/administer/task-table/c...
If you still wish to do it via the flow designer then you can use the if block in the flow designer to check the request type and use the update record action to update the assignment group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2024 01:31 AM
You can simply create a action in flow designer
- Create a input variable
Then clicking on that blue plus icon you can add script functionality
Then just drag the input variable in the script and write a simple if else script as per the requirement.
At the end create a output variable which should be passed (optional)
And add that action to a flow.
Please mark helpful if you accept the solution.
Thanks
Sanjana Adsul