Workflow Approval User Dynamically Based on Cat Item Variable Reference Field

Stephen Skaggs
Kilo Sage

I am trying to create a dynamic workflow approval based on a reference variable. For example, I have a point where a manager of a cost center is required for approval when the cost center variable is selected on the catalog item. For more details into what I mean, I will provide a better example.

Catalog Item Request --> Variable Cost Center A Selected from reference field --> Approval - Manager of Cost Center (dynamically based on the cost center that was selected).

If you need more info let me know.

 

 

1 ACCEPTED SOLUTION

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

You have to use Approval User activity in workflow. There you have to write below code in Script section. See below

find_real_file.png

 

I have mentioned script as well in Script box above.

Thanks,
Ashutosh

View solution in original post

7 REPLIES 7

Prateek kumar
Mega Sage

If its a reference variable, do something like this

current.variables.cost_center.YourRequiredField.toString();

 


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

Can you provide context to where this should go? Based on your example I am trying the following in the scripting area for Approval- User on the workflow:

 

current.variables.cost_center.cmn_cost_center.code.toString();

 

I am receiving the following error when I attempt to use this code for the approval user:

"illegal use to getmessage in class org.mozilla.javascript.rhino exception"

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

You have to use Approval User activity in workflow. There you have to write below code in Script section. See below

find_real_file.png

 

I have mentioned script as well in Script box above.

Thanks,
Ashutosh

Thank you for the info. I am no longer getting the error.

 

I am noticing now that it skips this approval now in the workflow. Like there is no approver.