Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Validating Related List Records in ATF

Khalid9030
Tera Contributor

Hello Team,

 

We have an ATF requirement as follows:

  1. Create a new record and attach a file to that record.
  2. Run a scheduled job that imports data into other tables.
  3. Open the newly created record from step 1 and validate the related list records.

Steps 1 and 2 can be achieved in ATF. However, regarding step 3, if it is possible to do this in ATF, please let me know how it can be done.

7 REPLIES 7

Yes, Utilize the 'record query' and query of [task_ci] table. Now, you can pass the save/submit step in the highlighted part of the screenshot and then you will get that result.. in the next step you will use 'open and existing record' 

 

SN_Learn_0-1734421536855.png

 

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

@SN_Learn  & @Ankur Bawiskar 

Actually, i want to display a message in output for that i have written a code in Run Server-side script as below. but here i am not getting the message same checked in background script its working 

Code:

function(outputs, steps, params, stepResult, assertEqual) {
    // add test script here
var mmRecordSysID = steps('3a66daa9c3e21a50773116977a01314b').record_id; // Submit form step sys_id taken here 
var mmgr = new GlideRecord('x_fu_mast_main_request');
mmgr.addQuery('sys_id',mmRecordSysID);
mmgr.addQuery('status','completed');
mmgr.query();
if(mmgr.next()) {
 
var grLog = new GlideRecord('x_fu_np_lv_import_log');
grLog.addQuery('request_number',mmRecordSysID);
grLog.addQuery('level','info');
grLog.query();
if(grLog.next()){
 
outputs.table = 'x_fu_np_lv_import_log';
outputs.record_id = grLog.message;
stepResult.setOutputMessage("The import Log Message is" +grLog.message);
stepResult.setOutputMessage("Successfully Log generated");
 
        stepResult.setSuccess();
 
return true;
 
}
 
else{
 
stepResult.setOutputMessage("Failed to find message");
 
stepResult.setFailed();
 
return false;
 
}
 
}

Could you please check the code. 

Shaqeel
Mega Sage
Mega Sage

Hi @Khalid9030 

 

Yes 3rd one is also possible in ATF.

You can find the test under List and related list steps:

Shaqeel_0-1734354322846.png

***********************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

***********************************************************************************************************************

 

 

Regards

Shaqeel


***********************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

***********************************************************************************************************************





Regards

Shaqeel