- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2023 07:08 AM
I have a table called "Cloud Container" which has a field "Install Status" which is a choice option field having choices "Onboard" and "Not Onboard" . I have a catalog item with a refernce field "Cloud" referencing to Cloud Container field,
If the user selects a particular record from the "Cloud" field in catalog item then for that record selected the value of the "Install Status" field should be updated to "Onboard".
I am using run script activity in WF but the value is not getting updated.
var gr=new GlideRecord('u_cloud_container');
gr.addQuery('name',current.variables.cloud_resource_container);
gr.query();
while(gr.next()){
gr.install_status = "Onboard";
gr.update();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2023 07:14 AM
Hi @surbhi_123
Try with below script - i made a change to query by sys_id instead of name
var gr=new GlideRecord('u_cloud_container');
gr.addQuery('sys_id',current.variables.cloud_resource_container.sys_id);
gr.query();
while(gr.next()){
gr.install_status = "Onboard";
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2023 07:14 AM
Hi @surbhi_123
Try with below script - i made a change to query by sys_id instead of name
var gr=new GlideRecord('u_cloud_container');
gr.addQuery('sys_id',current.variables.cloud_resource_container.sys_id);
gr.query();
while(gr.next()){
gr.install_status = "Onboard";
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2023 07:15 AM
@surbhi_123 Update the script like below
var gr=new GlideRecord('u_cloud_container');
gr.addQuery('sys_id',current.variables.cloud_resource_container);
gr.query();
while(gr.next()){
gr.install_status = "Onboard";
gr.update();
}
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023