- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 07:29 AM
I have created a record in an ATF, but I'm struggling to get the incident-number, I'm only able to get the sys_id. Anyone who could help me get the Incident-number from a record-object? As I have figured it out, this need to be done in a server side script-step.
Solved! Go to Solution.
- Labels:
-
Automated Test Framework
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2022 01:22 AM
Hi,
you need to create new and then you would find it during adding the step
1) left nav step configurations
2) create new
3) create input, output variables use script
Then you can select it during adding the step in ATF
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2022 01:22 AM
Hi,
you need to create new and then you would find it during adding the step
1) left nav step configurations
2) create new
3) create input, output variables use script
Then you can select it during adding the step in ATF
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2022 01:52 AM
Ah okay, thank you. Should i write a script? What should this contain?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2022 02:14 AM
Hi,
you will be passing the record sys_id as input
so in script query the table and set the number in output variable
something like this
(function executeStep(inputs, outputs, stepResult, timeout) {
var sysId = inputs.u_sysid;
var tableName = inputs.u_tablename;
var gr = new GlideRecord(tableName);
gr.addQuery("sys_id", sysId);
gr.query();
if (gr.next()) {
outputs.u_number = gr.getDisplayValue();
}
}(inputs, outputs, stepResult, timeout));
Input variables
Output variable
How to pass value to this custom step
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader