Auto populate approver name based on the selection of a variable value

sravya vemula
Tera Contributor

Hi Team,

I am working on a requirement where there is a select box variable with 16 question choices.

I need to assign the approval task to various people based on the value selected in the select box. 

I have tried doing this in flow designer but it all became clumpsy and thereafter I also need to assign the sctask to various groups based on the select box value. Could you help out here ?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@sravya vemula 

you can use inline script for group field while you create the catalog task via flow

in that script check value of that choice variable and accordingly set the group sysId

var val = fd_data.trigger.request_item.variables.variableName;

if(val == 'choiceValue1')
return 'groupSysId1';
else if(val == 'choiceValue2')
return 'groupSysId2';

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

9 REPLIES 9

@sravya vemula

are you saying approval for RITM based on choice value of variable?

if yes then check this on how to have scripted approval in flow

Flow Designer Approvals Overview - Workflow Automation Center of Excellence 

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

@sravya vemula 

Thank you for marking my response as helpful.

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

sravya vemula
Tera Contributor

I have 16 choices with 7 different approvers.

sravya vemula
Tera Contributor

Can I use inline script for approver also ? If so, how can I retrieve approver name in flow ?

Amit Gujarathi
Giga Sage
Giga Sage

HI @sravya vemula ,
I trust you are doing great.

Here's a high-level solution to achieve this:

  1. Create a Business Rule:

    • Navigate to "Business Rules" in the ServiceNow Studio or the application menu.
    • Create a new business rule and set the appropriate conditions to trigger it when the select box variable is updated.
    • In the script, based on the selected value, set the assignment group or the individual assignee for the approval task and the service catalog task.
    • Save and activate the business rule.
  2. Create a Workflow:

    • Navigate to "Workflows" in the ServiceNow Studio or the application menu.
    • Create a new workflow and configure it to trigger when the approval task is created.
    • Define the required activities/states in the workflow, such as approval steps, task assignments, etc.
    • For each activity, set the assignment group or individual assignee dynamically based on the value selected in the select box variable.
    • Save and publish the workflow.

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi