how to calculate reassignment count
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 11:30 PM
Hi All,
please help me with below requirement.
In incident form I have created 2 fields 1st one is checkbox name with FCR and 2nd is string name with Reassignment count group. Now my requirement is that when incident ticket is assigned to me or 1st person and he did not reassign that ticket to some other person at that time checkbox should check and Reassignment count group automatically count as 0. and if I reassign the ticket to some other person at that time checkbox should un-check and 2nd field count should in-cress.please let me know how to do it.
Thanks & Regards
K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 11:39 PM
Hi @keval3 ,
You can achieve this requirement using a business rule on the Incident table. Here's one way to implement it:
Create a new integer field on the Incident table called "Reassignment Count".
Create a new business rule on the Incident table that runs when the record is updated. Set the "When to run" condition to "current.assignment_group.changes()" to ensure that the rule only runs when the assignment group is changed.
In the business rule script, check if the "FCR" checkbox is checked. If it is, set the "Reassignment Count" field to 0 and exit the script.
If the "FCR" checkbox is not checked, increment the "Reassignment Count" field by 1 and uncheck the "FCR" checkbox.
Here's some sample code to get you started:
(function executeRule(current, previous /*, g */) {
// Check if the FCR checkbox is checked
if (current.u_fcr) {
current.u_reassignment_count = 0;
return;
}
// Increment the Reassignment Count and uncheck the FCR checkbox
current.u_reassignment_count = (previous.u_reassignment_count || 0) + 1;
current.u_fcr = false;
})(current, previous /*, g */);
If my response was helpful in resolving the issue, please consider accepting it as a solution by clicking on the ✅Accept solution button and giving it a thumbs up 👍. This will benefit others who may have a similar question in the future.
Thank you!
Ratnakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2023 05:30 AM
Hi Ratnakar,
I have written below script but it is not working properly
(function executeRule(current, previous) {
if ((current.u_reassignment_count_assigned_to = 0) && (current.reassignment_count = 0)) {
(current.u_fcr = true); {
return;
}
current.u_reassignment_count_assigned_to = previous.u_reassignment_count_assigned_to || 0 + 1;
(current.u_fcr = false);
}
})(current, previous);
please let me know the solution.
Thanks & Regards
K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2023 10:45 PM
Hi @keval3 ,
Here's an updated version that should address these issues:
(function executeRule(current, previous) {
// Check if the incident has not been reassigned before
if (current.u_reassignment_count_assigned_to == 0 && current.reassignment_count == 0) {
// Set the FCR checkbox to true
current.u_fcr = true;
} else {
// Increment the reassignment count and set the FCR checkbox to false
current.u_reassignment_count_assigned_to = (previous.u_reassignment_count_assigned_to || 0) + 1;
current.u_fcr = false;
}
})(current, previous);
Thanks,
Ratnakar