- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2023 11:38 PM
Hi All,
I have a variable called u_user on catalog form referring to sys_user table.
I wanted to trigger approval for the user selected in this variable. Please let me know how to achieve this?
I used below scrip in approval user activity in worklfow:
var answer = [];
answer.push(current.variables.u_user);
But not triggering. Please help me.
Thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2023 02:01 AM
should be easy one provided user has email, user is active and not locked out
var answer = [];
answer.push(current.variables.u_user+'');
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2023 11:56 PM
Hi ,
You can achieve through workflow,drag user approval activity write the code as below.
var answer = [];
answer.push(current.variables.u_user.toString());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2023 11:57 PM
Please mark the answer if it is helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2023 01:51 AM
Hi @Rekha20 ,
That variable is reference field then that variable must have user sys_id. So that above statement should work. But you can try below debugging for workflow:-
1. Check the Workflow Context: Ensure that the u_user variable is set and contains a valid sys_id before the approval user activity is executed.
var answer = [];
answer.push(current.variables.u_user);
gs.info("Answer: " + answer);
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2023 02:01 AM
should be easy one provided user has email, user is active and not locked out
var answer = [];
answer.push(current.variables.u_user+'');
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader