Issue
Symptoms
Upon adding a work note using the Post UI action, & change of Incident State to On Hold & On Hold Reason to Awaiting Customer, the work notes is duplicated
Release
Jakarta Patch 9c
Kingston Patch 9
London Patch 2
Browsers: Chrome & Firefox
Steps to Reproduce
Step 1: Open an incident in In Progress state.
Step 2: Add a work note, and click on Post
Step 3: Change the state to On hold, and On hold reason to Awaiting customer
Step 4: Check the work notes field, and its populated with the previous work note that was just posted.
Expected behavior
The work notes should not get duplicated after the state and on hold reason is changed.
Actual behavior
Work notes is getting duplicated after the work note is added to activity log by clicking the Post button.
However, if the form is reloaded after the post operation, and then the state & on hold reason are changed, the work notes is not getting duplicated.
Also if the work notes is added, using the save operation, the work notes are not duplicated.
It only happens when the post operation is used, and form is not reloaded or refreshed.
Workaround
Create a Client Script as below which clears the work notes field on the state and on hold reason change
function onChange(control, oldValue, newValue) {
if (oldValue == newValue)
return;
console.log("PREVIOUS OHR: " + oldValue + "\nNEW OHR: " + newValue + "\nGetState: " + g_form.getValue("state"));
if (g_form.getValue("state") == 3 && newValue == 1){
g_form.setValue('work_notes','');
g_form.setMandatory('comments', true);
}
else
g_form.setMandatory('comments', false);
}