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.

Run server side script in ATF

Community Alums
Not applicable

Iam trying to create a run server side script for ATF to query , update and insert the record in samp_custom_sw_product table , But Iam getting error as mention below.

 

--------------------------------------------------------------------------------------------------------------------------------------------------------------

ERROR:testing incomplete (check that all asynchronous functions made their callbacks)

Full logging from step execution:
09:18:16.551 Loading script: jasmine_lib/jasmine31.js
09:18:16.557 Successfully loaded jasmine_lib/jasmine31.js
09:18:16.562 App:<a href="sys_scope.do?sys_id=44d8f71b1be4d1107fe72f05604bcbae" target="_blank">SAM Implementation</a> x_att2_sam_implmtn: test2
09:18:16.565 App:<a href="sys_scope.do?sys_id=44d8f71b1be4d1107fe72f05604bcbae" target="_blank">SAM Implementation</a> x_att2_sam_implmtn: test2
09:18:16.575 App:<a href="sys_scope.do?sys_id=44d8f71b1be4d1107fe72f05604bcbae" target="_blank">SAM Implementation</a> x_att2_sam_implmtn:
----- Tests Complete -----
Test results :: (0/0) :: incomplete.
---------------------------------------------------------------------------------------------------------------------------------------------------------------
LOGIC:
1.query the record present in ('samp_custom_sw_product') table.
2.if present update the record.
3.else craete new record in the samp_custom_sw_product table.

 


---------------------------------------------------------------------------------------------------------------------------------------------------------------
CODE:

(function(outputs, steps, params, stepResult, assertEqual) {


var gr = new GlideRecord('samp_custom_sw_product');
gr.addQuery('manufacturer','7d6b8ba387faac10fce97628cebb359e');// reference field of Adobe System
gr.addQuery('prod_name','zaber1244');
gr.query();
gs.info('test1');
if (gr.next()) {
gr.prod_name = 'zaber1245';
//gr.update();
gs.info('test2');

outputs.table = 'samp_custom_sw_product';
outputs.record_id = gr.update();
stepResult.setOutputMessage("Successfully update record");
return true; // pass the step
}
else{

var gp = new GlideRecord('samp_custom_sw_product');
gp.initialize();
gp.manufacturer = '7d6b8ba387faac10fce97628cebb359e'; //sys id of publisher
gp.category = 'demo software566775';

//gp.insert();
gs.info('test3');
outputs.table = 'samp_custom_sw_product';
outputs.record_id = gp.insert();
stepResult.setOutputMessage("Successfully inserted record");
return true;

}
})(outputs, steps, params, stepResult, assertEqual);

jasmine.getEnv().execute();

 

please help me to resolve this issue.

 

0 REPLIES 0