- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2017 08:25 AM
Hi All,
We have a 'Cancel Change' UI action on our change request form. This currently has the following code:
I was looking to add something like the below code to this, so that when the change is cancelled it finds any records in the task_ci table that have the same change number and then clears the xml field:
var pc = new GlideRecord('task_ci');
pc.addQuery('task',current.number);
pc.query();
while (pc.next())
{
pc.xml = "";
}
})(current, previous);
However this has not worked and the xml field does not clear. Any suggestions as to where I have gone wrong will be greatly appreciated.
Thanks
Sam
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2017 08:28 AM
Sam,
You dont have pc.update() to update
have like this :
var pc = new GlideRecord('task_ci');
pc.addQuery('task',current.sys_id);
pc.query();
while (pc.next())
{
pc.xml = "";
pc.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2017 08:28 AM
Sam,
You dont have pc.update() to update
have like this :
var pc = new GlideRecord('task_ci');
pc.addQuery('task',current.sys_id);
pc.query();
while (pc.next())
{
pc.xml = "";
pc.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 05:27 AM
Hi Mani,
Thanks for the above. I knew I would be missing something straightforward. Still learning the scripting side!
Also I was using current number rather than current.sys_id.
Working great now,
Thanks for your help.