Getting save changes message on case when no changes made

sid23
Mega Contributor

find_real_file.png

We have two fields called "reassignment reason" and "reassignment note". When a case is created these two fields do not show on the case form and this was achieved by having an onchange client script. Script below - 

Type - onChange
Script -
function onChange(control, oldValue, newValue, isLoading, isTemplate) {

if (isLoading || newValue == oldValue || oldValue == '') {
g_form.setValue('u_reassignment_reason','');
g_form.setValue('u_reassignment_note','');
g_form.setDisplay('u_reassignment_note',false);
g_form.setMandatory('u_reassignment_reason',false);
g_form.setDisplay('u_reassignment_reason',false);

//return;
}
// if(newValue != oldValue && newValue!=''){
else
{
g_form.setValue('u_reassignment_reason','');
g_form.setValue('u_reassignment_note','');
g_form.setDisplay('u_reassignment_note',true);
g_form.setDisplay('u_reassignment_reason',true);
g_form.setMandatory('u_reassignment_reason',true);


}

//Type appropriate comment here, and begin script below
}

I believe this is causing the above issue. When a user changes the assignment group these two fields pop up and the user has to enter those two fields. And then the case is saved or submitted. But when the user opens the same case record and when the form loads these two fields disappear which is correct but i think the previous value entered by the user is still present in those two fields but just not visible due to the script above and as a result when the user does not make any change and tries to go back(click on the arrow on the header to go back) the save changes message appears.

Any help on this? or is what i am thinking is wrong and something else is causing this issue?

5 REPLIES 5

Ct111
Tera Sage

Hi Sid,

 

You are applying onChange on which field 

 

I mean what have you selected in Field name while creating this client script .

 

 

PLEASE mark my answer as CORRECT if it served your purpose

 

 

 

Ct111
Tera Sage

Hi Sid,

The message your are getting on clicking the BACK button will only come if some changes have been made to the form on any of the fields.

          And secondly, regarding that reassignment_note and reassignment_reason you have set the code as visible only in case of Assignment group change hence it won't be visible after the form loads.

 

you can modify it something like

var fctvalue = g_form.getValue('u_reassignment_note');

if(fctvalue != ' ')

{

g_form.setDisplay(''u_reassignment_note',true);

}

 

 

Please Mark my answer as CORRECT if it served your purpose.

sid23
Mega Contributor

Exactly, only if the assignment group is changed then these two fields appear. So do you think this is not causing the error?

sid23
Mega Contributor

And this warning message displays only when those two fields are entered and then saved and when the same record is opened again. This does not happen with any other records where these two field were not entered at first.