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

You have to put sysid inside the 2nd line, not the text

Best Regards
Aman Kumar

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Can you share your complete test steps screenshot and what are you about to test as part of functionality?

Regards
Ankur

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

@VIKAS MISHRA 

any update on this?

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

Within my ATF i am creating one record from portal and then in native form i want to update one field's value through script, just focus on this that that field value should be updated thorugh script only to check some functionality hence i do not want to change that field value trough set field value step.

So if i create that ticket from portal manually then i can actually use fix script and background script to change its value but when i am trying this within ATF i can only have one script step which is "run server script". so now the scripts that i have created manually outside atf is working fine but if i am using the same script in step "run server script" is not working. 

 

In "run server script" step i want to glide that particular record only which i have created in above steps in that ATF only, so i do not know how can i get that record trough script within ATF.

 

Below is the script that i am using manually outside atf but within ATF "run server script" its not working. 

 

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();
}

Hi,

Can you share your previous steps screenshot?

Regards
Ankur

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