
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2020 02:14 AM
Hi Team,
This is related to ATF (Service catalog in service portal). I have a requirement to show a log message in an ATF test step. I am doing 'Record Query' on log table then adding 'Open an existing record' step,
Log message contains the RITM no. This is the key to fetch the log message.
But I am unable to get RITM no. in the test steps. When we order a catalog item then we are getting REQ no. Now to get RITM no, I added a test step 'Record Query' on sc_req_item table (filter i uses as - Request is output of Order a catalog item)
By doing this I am able to get the sys id of RITM But I want RITM no so that I will use this to fetch log message.
Please let me know if we can fetch RITM no or not
Regards,
Gaurav
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2020 03:22 AM
Hi Gaurav,
Here is the script. Please replace the SYS_ID of the test step accordingly:
(to get the sys_id open the Record Query on sc_req_item table test step, and copy sys_id from context menu like we do in normal forms.)
(function(outputs, steps, stepResult, assertEqual) {
// add test script here
var gr = new GlideRecord("sc_req_item");
gr.get(steps('**sys_id of TEST STEP that has the RITM sys_id').record_id);
outputs.table = 'sc_req_item';
outputs.record_id = gr.getValue('number');
stepResult.setOutputMessage(gr.getValue('number'));
})(outputs, steps, stepResult, assertEqual);
Thanks,
Debopriya

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2020 06:02 AM
Thank You for the script. did not get the output what I was expecting.
Above test step 'Run Server Side Script' ran successfully. It gives below Output. Though, I cannot see the RITM no in this output
Then I have used this as below
This above step got failed. and the failed message is
Do u have any idea?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2020 06:59 AM
Hi Gaurav,
Change the 2nd line of the code a little:
gr.get(steps("**sys_id of TEST STEP that has the RITM sys_id").first_record);
Thanks,
Debopriya

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2020 05:46 AM
Thank You very much Debopriya. It worked..
Regards,
Gaurav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2021 02:31 PM
Hello Debopriya,
I am having the issue but the sys_id I am using is dynamic and it changes every time the test is executed and rolled back. is there a way I can enter the sys_id that is picked up from previous step.
Thank you
Harshul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2020 07:16 AM
Hi Gaurav,
What are you trying to test by doing query on sys_history_line table
your run server side script step is returning RITM sys_id; but you are checking it against New field
please share screenshot of all the test steps along with sequence
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader