- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2022 08:06 AM
I have to pass value from UI action page to my work flow where i am able to pass the incident value from work flow but not able to pass sys_id of the incident to my workflow. i am using below code to pass the incident number and sys id.
Working code
ServiceNowIncidentId:current.variables.associatedincidentnumber.getDisplayValue(),
Not working code (not able to pass sys id to my workflow)
INSysid:current.variables.associatedincidentnumber.sys_id.getDisplayValue(),
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2022 09:44 AM
Hi,
If your variable is of type string then you need to use GlideRecord query to get sys_id.
var incSys_id = '';
var incId = new GlideRecord('incident');
incId.addQuery('number',current.variables.associatedincidentnumber.toString());
incId.query();
if(incId.next()){
incSys_id = incId.getUniqueValue();
}
// put above code in your script and use incSys_id to pass sys_id
INSysid:incSys_id,
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2022 08:22 AM
Hi,
To pass sys_id you don't need to use getDisplayValue().
You can use like below:
INSysid:current.variables.associatedincidentnumber.sys_id.toString();
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2022 08:30 AM
Hi Anil,
Thanks for your response but below code is not passing the sys id value
INSysid:current.variables.associatedincidentnumber.sys_id.toString();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2022 08:47 AM
Hi
Is you variable is reference ,use below code;
INSysid:current.variables.associatedincidentnumber.toString(),
Regards,
Naveen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2022 09:06 AM
Thanks naveeb,
it is passing the Incident number but i need to pass the sys_id of the incident.