ATF - Run server side script not able to get the previous step Sys ID of the record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2020 01:18 PM
I have only 3 steps. 1)Impersonate(ITIL user) 2) log and 3) Run server side script.
There are only 1 parameters(parametrized test) 1) Group name: Change Management (referenced)
I am using 'log' as a step to pass on group Syd ID. (step sys-id and group sys-id) are fine and working alright.
Somehow the below in my script is not working. I tried all the list options.
This line is not working: grp_sysid = steps(last_step_sysid).record_id;
(function(outputs, steps, stepResult, assertEqual) {
var last_step_sysid = 'b048fd8c074788105e7efc289c1ed05c';
grp_sysid = steps(last_step_sysid).record_id;
//grp_sysid = 'a715cd759f2002002920bde8132e7018';
var gr = new GlideRecord('sys_user_group');
gr.get('sys_id', grp_sysid);
var theIDiwant = '';
theIDiwant = gr.name;
outputs.record_id = theIDiwant;
gs.log('***** Group name *******: ' + outputs.record_id);
gs.addInfoMessage(gr.name);
})(outputs, steps, stepResult, assertEqual);
I am seeing group name empty.
You may please try through a dev instance.
I appreciate any help. Thanks
- Labels:
-
Automated Test Framework

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2020 07:38 PM
Check the outputs of the Test Step you are referring to ensure you are getting the correct value.
They are different depending on the Step.
- Navigate to "Automated Test Framework > Step Configurations"
- Open the Step you are making reference to
- Check 'Output Variables' tab
Example for 'Order Catalogue Item'
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2020 10:13 PM
Thanks Paul. After I wrote the above, I started finding other community posts and someone said exactly what you said. So I did that. I tried request_id. Nothing. Undefined. I tried Request. Nothing. Undefined. Then I tried to access a different step. My first step is impersonation, so I copied that sys_id and used the variable user and it worked. I'm beginning to wonder if Order (SP) is broken, but I'm not reading about anyone else having the same issue. It's so odd.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2020 10:58 PM
That is weird. You may have stumbled upon a bug.
I am building an ATF Test Recorder, where I am currently building functionality to record the population of SC order forms and I have been able to get the Request ID out of the non-SP Order step.
I might face this issue when I try to implement for the Service Portal Order step.
I'll report back if it is broken for me too.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2020 10:58 PM
So I'm an idiot. I was using the normal Service Catalog steps instead of the Service Catalog (SP) steps. Thanks for replying to my comment, though!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2020 12:44 AM
No worries.
Give us a helpful if it was useful or solved if it fixed your issue.
Let me know if you have any other ATF woes.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022