- 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-30-2024 06:55 AM
Can you do same thing using the Run Server side ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2024 08:26 AM
No because that OOB step has pre-defined output variable and you cannot add a custom output variable to it
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
01-27-2025 06:28 AM
You can do using 'Run server side script' test step by using the script like below example.
Unfortunately, you can't take the Output of the Record query test step as Input in the Run server side script. So, you need to add the query in the script for your table.