Workflow approval script is not working in requted item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
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! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
share screenshot of where you wrote the script
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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
