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-28-2022 04:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 05:48 AM
so which record you are inserting?
which step is that?
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 06:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 08:16 PM
Hi,
line 81,82, 86 not required
also give the step sysId which has that record
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
05-23-2022 01:25 AM
Hi Ankur,
This still not working we have tried below mentioned code there but its doing nothing.
Could you please confirm if this is actually possible or not i mean to update the field value as we can do through background script.
(function(outputs, steps, stepResult, assertEqual) {
var gr = new GlideRecord('x_amex_sourcing_request_request');
//gr.addQuery('sys_id','de8cace91beb8d106f82ca6b234bcb9d');
//gr.get(steps('sys_id').first_record);
gr.get(steps('39f955d31b0f81906f82ca6b234bcb48').record_id);
//gr.addQuery('sys_id','39f955d31b0f81906f82ca6b234bcb48');
gr.query();
if(gr.next()){
gr.x_amex_sr_si_service_description = 'Testing by vikas000';
gr.update();
}