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

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. 

ACripps
Tera Contributor

Hi @Sandeep Rajput .  Thank you for getting back to me. 
If i was to remove this Business rule, this would mostly stop the duplicate work note entries?  

@ACripps If you will remove the BR then it will stop adding the worknotes on the record. 

Work notes are still appearing but the only difference is we are now missing the assignment group (once re-assigned) within the Work note entry