- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2022 09:06 AM
Hello Everyone,
I have an Requirement in Agent Workspace. we would like for the interaction to be automatically closed when it gets attached to a TASK, INC or RITM.
Thanks in advance.
Rajesh B.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2022 09:23 AM
Hi Rajesh,
Create a new BR on the 'interaction_related_record' record with the table conditions if you want or simply a BR with the following script will close interaction as soon as a record is created from the interaction. (you have mentioned TASK Table, incident and Requested item table would be extended from TASK so the below BR without any condition should work for you)
(function executeRule(current, previous /*null when async*/ ) {
var closeInteractionRec = new GlideRecord('interaction');
closeInteractionRec.get(current.interaction.sys_id);
closeInteractionRec.state = 'closed_complete';
closeInteractionRec.update();
})(current, previous);
Thanks
-Harneet Sital (ServiceNow Certified Technical Architect)
Request you to please mark my answer as helpful or correct based on the impact
Find all my ServiceNow articles here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2022 09:23 AM
Hi Rajesh,
Create a new BR on the 'interaction_related_record' record with the table conditions if you want or simply a BR with the following script will close interaction as soon as a record is created from the interaction. (you have mentioned TASK Table, incident and Requested item table would be extended from TASK so the below BR without any condition should work for you)
(function executeRule(current, previous /*null when async*/ ) {
var closeInteractionRec = new GlideRecord('interaction');
closeInteractionRec.get(current.interaction.sys_id);
closeInteractionRec.state = 'closed_complete';
closeInteractionRec.update();
})(current, previous);
Thanks
-Harneet Sital (ServiceNow Certified Technical Architect)
Request you to please mark my answer as helpful or correct based on the impact
Find all my ServiceNow articles here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 07:12 AM
is there a way for this to work on the UI form instead of just the agent workspace?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 06:49 AM
Hello, I implemented your BR, and it worked great, but I am having an issue with clicking on the "info" icon for the user profile and that action is closing the interaction. It should only close if it is transferred to a REQ, INC, or CHG. Would you happen to know why?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
In case someone else comes across this, there are few significant bugs in the code.
(function executeRule(current, previous /*null when async*/ ) {
if (current.task) { //CONFIRM A TASK HAS BEEN SET ON THE INTERACTION. THIS TABLE IS USED FOR OTHER PURPOSES
var closeInteractionRec = new GlideRecord('interaction');
if (closeInteractionRec.get(current.interaction.sys_id)) { //WHEN USING GET, ALWAYS CHECK WITH AN IF
closeInteractionRec.state = 'closed_complete';
closeInteractionRec.update();
}
}
})(current, previous);
