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 09:18 PM
You have to put sysid inside the 2nd line, not the text
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2022 09:38 PM
Hi,
Can you share your complete test steps screenshot and what are you about to test as part of functionality?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2022 11:21 PM
any update on this?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 01:02 AM
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();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 01:43 AM
Hi,
Can you share your previous steps screenshot?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader