how to add script into flow designer that return a group for approval or for sc_task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi,
Im trying to create a flow designer with 'Ask for Approval' and ' Create Catalog task' Actions.
In eact Action i need to write a script that relevant to the specific action:
1) return the group for approval
2) return the group that the task will be created on (assignment group field)
What should I put in each script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @Alon Grod
These are some scripts examples
For Create Task, you can set Assignment group → choose Script.
var group = new GlideRecord('sys_user_group');
group.addQuery('name', 'Service Desk');
group.query();
if (group.next()) {
outputs.assignment_group = group.sys_id.toString();
}
The Ask for Approval action lets you define Approvers → pick Script.
var group = new GlideRecord('sys_user_group');
group.addQuery('name', 'Network Approval Group');
group.query();
if (group.next()) {
outputs.approvers = group.sys_id.toString(); // must return sys_id
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
you can use scripted flow approval, check this
Scripted Approvals in Flow Designer with Flow Variables
Also you can use script using f(x) inline script for setting the group.
what did you start with and where are you stuck?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @Alon Grod ,
What script you are looking for?
Could you explain your requirement, from where you want to get group details, where group details are stored?
Thanks
Anand