how to add script into flow designer that return a group for approval or for sc_task

Alon Grod
Tera Expert

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?

 

 

WhatsApp Image 2025-09-28 at 14.23.15.jpeg

Screenshot 2025-09-28 at 14.46.58.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Alon Grod 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

4 REPLIES 4

Rafael Batistot
Kilo Patron

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

    }

 

@Rafael Batistot its not working

Ankur Bawiskar
Tera Patron
Tera Patron

@Alon Grod 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Anand2799
Giga Guru

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