//getting value of a field and display it on different fields with java script model driven app function customJS(executionContext){ // debugger; var formContext = executionContext.getFormContext(); //Getting the value of Frist name var getValue = formContext.getAttribute("tmr_firstname").getValue(); console.log(getValue); //Getting the value of last name, job title and company name var lastName = formContext.getAttribute("tmr_lastname"); var jobTitle = formContext.getAttribute("tmr_jobtitle"); var company = formContext.getAttribute("tmr_company"); //alert(getValue); //Dialog Box With First name var confirmStrings = { text:"Did you want to update the values of Last name and Job title?", title:"Confirmation Dialog Box by " + getValue}; var confirmOptions = { height: 200, width: 450 }; Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then( function (success) { if (success.confirmed){ console.log("Dialog closed using OK button."); //Setting the value of last name, job title and company name with concatination some text lastName.setValue(getValue + " (Last Name)"); jobTitle.setValue(getValue + " (job)"); // if Perchase Process is set to Indivisual then it will update the value of Company name var getPerchaseProcess = formContext.getAttribute("tmr_purchaseprocess").getValue(); console.log("getPerchaseProcess " + getPerchaseProcess); if(getPerchaseProcess == 0){ company.setValue(getValue + " (Company Name)"); } }else console.log("Dialog closed using Cancel button or X."); }); }