Duplicate work note entries in the Incident form (Business rule script). Kindly asking to help me

ACripps
Tera Contributor

Hi all,
Just wondering if someone is able to help understand this script within business rule please
Thank you 

(function executeRule(current, previous /*null when async*/) {
    // Add your code here
    if(current.reassignment_count == 2){
        current.work_notes = 'Incident reassigned - Escalated \nDate: ' + current.sys_updated_on + '\nReassigned by: ' + gs.getUserDisplayName() + '\nPrevious Assignment Team: ' + previous.assignment_group.getDisplayValue() + '\nCurrent Assignment Team: ' + current.assignment_group.getDisplayValue();
    } else {
            current.work_notes = 'Incident reassigned \nDate: ' + current.sys_updated_on + '\nReassigned by: ' + gs.getUserDisplayName() + '\nPrevious Assignment Team: ' + previous.assignment_group.getDisplayValue() + '\nCurrent Assignment Team: ' + current.assignment_group.getDisplayValue();
    }
})(current, previous);
1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@ACripps This business rule checks of the reassignment count for the current record is equal to 2 if the condition evaluates to true then it prepares a work note with Escalated word added to Incident reassigned string. The worknote is essentially the same in both the cases, condition was checked to just add Escalated word for those records where is reassignment count is equal to 2. 

View solution in original post

10 REPLIES 10

ACripps
Tera Contributor

de-activated the BR. There is no duplicate but the only difference is we have this information missing when reassigning 

 
Work notes
07-11-2024 16:41:09
22d ago
Incident reassigned
Date: 2024-11-07 16:41:09
Reassigned by: 
Previous Assignment Team: 
Current Assignment Team: