ATF: steps(SYS_ID of previous step) evaluates to undefined

Ravish Shetty
Tera Guru

Hi all,

 

I am creating an end to end ATF test case where the user is submitting a laptop request, the request gets approved and fulfilled.

I have a step where I am retrieving a system value using the 'run server script' test step. here, I want to know the sys_id of the ticket created by the last step.

 

find_real_file.png

 

 

The above step does not work correctly as the 'steps(SYS_ID of the previous step)' is evaluated as undefined. I have validated that I am using the correct sys_id. the step being referred to here is a record query that is able to query at least 1 record and works correctly. I don't think this issue could be related to user access as the user impersonated here is an ITIL user.

 

Thanks,

Ravish

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Ravish Shetty 

record query step has output as "first_record"

so please update it as below and it should work

gr.get(steps('sys_id').first_record);

Regards
Ankur

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

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@Ravish Shetty 

record query step has output as "first_record"

so please update it as below and it should work

gr.get(steps('sys_id').first_record);

Regards
Ankur

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

Ravish Shetty
Tera Guru

Thanks, Ankur. This worked.

You are welcome

Regards
Ankur

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

Hi @Ankur Bawiskar,

1) record a query with some specifications and
2) open that form(I mean record).

I have already written above 2 steps and now
3) I need to write the server side script for getting the record's sys_id which I have opened in step 2
how to achieve 3rd step(server side script) in ATF ?