How to run a script within ATF.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2022 07:39 AM
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();
}
- Labels:
-
Agent Workspace

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2022 07:59 AM
Have you tried core activity "Run server side script"?
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2022 08:04 AM
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();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2022 08:09 AM
Correct,
you might wanna use
gr.get(steps(PREVIOUS_STEP_SYS_ID).first_record);
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2022 08:56 AM
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();
}