How to run a script within ATF.

VIKAS MISHRA
Tera Contributor

Manually i can use the background script to run the below mentioned script and update a particular field value, However now wants to know how can i run below mentioned script to update a field value within ATF. 

Script:

var gr = new GlideRecord('x_amex_sourcing_request_request');
gr.addQuery('number', SRCENG0036058);
gr.query();
if(gr.next()){
gr.x_amex_sr_si_service_description = 'Testing by vikas';
gr.update();
}

14 REPLIES 14

Aman Kumar S
Kilo Patron

Have you tried core activity "Run server side script"?

Best Regards
Aman Kumar

I have tried below mentioned code through step "Run Server Script" , but its not working, i think object "current" does not work in Run Server Script.

 

var gr = new GlideRecord('x_amex_sourcing_request_request');
gr.addQuery('number', current.number);
gr.query();
if(gr.next()){
gr.x_amex_sr_si_service_description = 'Testing by vikas';
gr.update();
}

Correct,
you might wanna use

gr.get(steps(PREVIOUS_STEP_SYS_ID).first_record);
Best Regards
Aman Kumar

I have used the code as mentioned below, 

Could you please suggest if i am doing something wrong here because its also not working. 

var gr = new GlideRecord('x_amex_sourcing_request_request');
gr.get(steps(PREVIOUS_STEP_SYS_ID).first_record);
gr.query();
if(gr.next()){
gr.x_amex_sr_si_service_description = 'Testing by vikas';
gr.update();

}