workflow

nameisnani
Mega Sage

HI team , 

 

need help in script 

 

I have a catalog item called ' SWA AD '

in that we have reference field ' Application Name ' which refers to cmdb_ci_service_auto table .

approvals has to trigger to the application service >> approval group

nameisnani_1-1758009186706.png

 

 

As this is old catalog already WF configured . 

So i am trying to achieve via script 

my scipr is not working 

please help me what was the mistake 

 

(function executeRule(current, workflow) {
    var groupId = "";
    if (current.u_application_name) {
        var app = new GlideRecord("cmdb_ci_service_auto");
        if (app.get(current.application_name)) {
            groupId = app.change_control; // adjust field name
        }
    }
    workflow.scratchpad.approvalGroup = groupId;
    return groupId;
})(current, workflow);

nameisnani_0-1758009031338.png

 

 

could you please prrovide me the updates script 

 

@Ankur Bawiskar 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@nameisnani 

update as this in your workflow advanced script for approval activity

answer = [];

answer.push(current.variables.u_application_name.change_control.toString()):

Approval - Group workflow activity 

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

7 REPLIES 7

@Ankur Bawiskar 

nameisnani_0-1758016918015.png

nameisnani_1-1758016958612.png

 

not worked @Ankur Bawiskar 

 

could you please help me where was mistake 

@nameisnani 

remove complete line of code before line 13 in script

Ensure that group has at least 1 member in it

It should work provided the variable name and field name is correct

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