Is there a way to detect which fields are being changed from a onSubmit Client Script ?

vinod9
Tera Expert

Hello SN Team,

Can you please tell me, how to identify field value of record changed using onSubmit client script.

@Mohith Devatte 

@Ankur Bawiskar 

Regards

Vinod

1 ACCEPTED SOLUTION

Mohith Devatte
Tera Sage
Tera Sage

hey vinod ,

can you tell the exact requirement ?

View solution in original post

8 REPLIES 8

Here is my code, while changing the view from Cxs_popup view to default view  getting error "onSubmit script error: can not read properties of undefined(reading'changed')".

function onSubmit() {
    //Type appropriate comment here, and begin script below
    var field1 = g_form.getControl('subcategory'); //Get the 'Caller' field control
    var field2 = g_form.getControl('business_service'); //Get the 'Short description' field control
    var field3 = g_form.getControl('urgency');

    
     if (field1.changed || field2.changed ) {
   
        return confirm("Values on the form have changed.\nDo you really want to save this record?");
  
    }

 

is there any other way where we can find out which field value of the record updated.

Note :The code working in sandbox but not in dev

@Mohith Devatte 

hey vinod 

try this once 

function onSubmit() {
  if(g_form.modified){
    return confirm("Values on the form have changed.\nDo you really want to save this record?");
  }
}

Thank you Mohith. I have added one more if condition, it worked for me 🙂


    if (g_form.modified) {
        if(field2.changed){
            
        
        return confirm("Values on the form have changed.\nDo you really want to save this record?");
    }

    }

vinod9
Tera Expert

Here is my code, while changing the view from Cxs_popup view to default view  getting error "onSubmit script error: can not read properties of undefined(reading'changed')".

function onSubmit() {
    //Type appropriate comment here, and begin script below
    var field1 = g_form.getControl('subcategory'); //Get the 'Caller' field control
    var field2 = g_form.getControl('business_service'); //Get the 'Short description' field control
    var field3 = g_form.getControl('urgency');

    
     if (field1.changed || field2.changed ) {
   
        return confirm("Values on the form have changed.\nDo you really want to save this record?");
  
    }

 

is there any other way where we can find out which field value of the record updated.

Note :The code working in sandbox but not in dev

@Mohith Devatte 

@Ankur Bawiskar