Need help on Run Server Side Script in ATF

Khalid9030
Tera Contributor

Hello Team,

 

Our requirement is to display the field value of a related list record using the 'Run Server Side' step. The provided code executes successfully during testing, but the output message is not displaying as expected, as shown in the attached file. Please assist me. 

 

Note : Same logic i have tested in background script with record sys id its working as expected 

 

 

(function(outputs, steps, params, stepResult, assertEqual) {
    // add test script here
var mmRecordSysID = steps('3a66daa9c3e21a50773116977a01314b').record_id; // Submit form step sys_id taken 
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;
 
}
 
}
1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Khalid9030 

did you create the correct output variable of that server side script step?

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

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Khalid9030 

did you create the correct output variable of that server side script step?

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

@Khalid9030 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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