How to Get Record sys id ATF

John Doe
Giga Expert

Hi I am working on ATF, where I have Open a Record in List step, after that step I need sys_id of the record opened in Open a Record for  run server side script.  

I tried 

var test = steps('sys_id').record_id;

stepResult.setOutputMessage(test);

Its showing output as 

undefined

 

Please help

1 ACCEPTED SOLUTION

@John Doe 

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

10 REPLIES 10

sheetalpadole14
Tera Contributor

Hi @Ankur Bawiskar 

I am stuck at ATF steps 

RITM Opens in Portal Instead of SC Task – Getting Client Error “Cannot read properties of undefined”

I’m working on ATF test cases for a specific catalog item. Creating RITM backend using run server side script once RITM created  in the steps, I use “Open an Existing Record” after creating the RITM.

In my PDI, this step opens the SC Task record directly after the RITM, which works correctly.

But in our project instance, the same step redirects the RITM to a Service Portal page instead of opening the SC Task form.

Because of this, the ATF test fails with the following client error:
TypeError: Cannot read properties of undefined (reading 'id')
Any suggestions or experience with this issue would be really helpful.