- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2024 09:12 PM
Hello,
In ATF, we have two Record Query steps with different conditions for the same table. These two record conditions are called in the Set Field Values step(PFA). When I call these two records, I am getting the sys_ids instead of the record numbers (PFA).
Could you please advise how to retrieve the record numbers instead of the sys_ids in ATF?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2024 10:00 PM
something like this
Step execution script:
(function executeStep(inputs, outputs, stepResult, timeout) {
var recordSysId = inputs.u_sysid
var gr = new GlideRecord("incident");
gr.addQuery("sys_id", recordSysId);
gr.query();
if (gr.next()) {
outputs.u_number = gr.getDisplayValue();
stepResult.setOutputMessage('Found the record');
stepResult.setSuccess();
} else {
stepResult.setOutputMessage('Record not found');
stepResult.setFailed();
}
}(inputs, outputs, stepResult, timeout));
For my testing: I used these steps and it worked and gave me the number taking sysId as input
Output:
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
12-29-2024 09:37 PM
record query will always give sysId and not the display field.
you will have to use custom server side script step, pass this sysId and query the table and get the number
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
12-29-2024 10:00 PM
something like this
Step execution script:
(function executeStep(inputs, outputs, stepResult, timeout) {
var recordSysId = inputs.u_sysid
var gr = new GlideRecord("incident");
gr.addQuery("sys_id", recordSysId);
gr.query();
if (gr.next()) {
outputs.u_number = gr.getDisplayValue();
stepResult.setOutputMessage('Found the record');
stepResult.setSuccess();
} else {
stepResult.setOutputMessage('Record not found');
stepResult.setFailed();
}
}(inputs, outputs, stepResult, timeout));
For my testing: I used these steps and it worked and gave me the number taking sysId as input
Output:
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
12-30-2024 12:50 AM
@Ankur Bawiskar Thanks for your response. let me try this and let you the results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2024 12:52 AM - edited 12-30-2024 12:55 AM
Sure
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader