State to Closed Complete in when moving to Done Column in VTB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2025 08:22 PM
Hello All,
Appreciat your help in advance.
I have created a business rule to change the state of the tasks to Closed complete when tasks are moved to Done column in VTB.
I'm not seeing the state being updated. Attached is a screen shot of the is the business rule that I have created. Please do let me know , what Am'I missing here? Please help.
The script is :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2025 08:58 PM
you should query the task table
(function executeRule(current, previous /*null when async*/) {
var ptaskGR = new GlideRecord('task');
ptaskGR.get(current.task.toString());
ptaskGR.setValue('state','3');
ptaskGR.update();
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 05:42 AM
Hello Ankur,
Thank you for your reply.
I implemented your script. But when I move the card to Done column, the card disappears from the lane giving a message, the card no longer matches the board criteria and removed from the board. It should stay in done column, when teh state is set to closed complete.
Please let me know what could be wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 05:48 AM
Hi @Shree Nag,
This is most likely due to a condition to remove cards on the VTB based on Card State.