- 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 09:39 AM
Hi,
What is the type of your variable 'associatedincidentnumber'?
Is it Reference or String?
Thanks
Anil Lande

- 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 11:56 PM
Hi
May i know the field type ?
Can you share the snippets exactly what you want
Regards,
Naveen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2022 11:21 PM
Yes Filed type is Text but after changing it to Reference.below code is working fine
INSysid:current.variables.associatedincidentnumber.toString(),