Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Workflow approval script is not working in requted item

986565
Tera Contributor

Hi All,

 

I am using the scripts for the individual approval based on the group person, for the catalog approval

 

Here is my code for the request item

 

current.variables.please_select_sr_approval

 

when i put logs it was printing, but unable to send request for the approval person.

8 REPLIES 8

@986565 

it should work fine provided

-> that variable is reference to sys_user

-> user you selected is active and not locked out and has email in it

Did you try some other hard-coded user sysId?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

986565
Tera Contributor

Hi @Ankur Bawiskar ,

When i am passing the direct sys_id it was sending the approval request, but when i am using the below code it was skipping, but i am able to see the logs of it.
I am unable to find what is the issue.

 

var approvalUser = current.variables.please_select_sr_director.toString();
gs.info('approval user ' + approvalUser);

answer = [];
answer.push(approvalUser);

 

 

@986565 

share screenshot of where you wrote the script

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

are you not declaring the answer as a variable ?

you should write it as  - var answer = [];

 

Also, try just using current.variables.please_select_sr_director;  instead of adding .toString();

 

Regards,

Nayan