0% found this document useful (0 votes)
7 views2 pages

Day 3

The document contains JavaScript functions designed to manipulate form data in a CRM system. The first function sets the value of a city attribute based on the form type, while the second retrieves the customer type and its label. The third function sets a loan type based on the selected customer type, with error handling included in each function.

Uploaded by

venkatesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Day 3

The document contains JavaScript functions designed to manipulate form data in a CRM system. The first function sets the value of a city attribute based on the form type, while the second retrieves the customer type and its label. The third function sets a loan type based on the selected customer type, with error handling included in each function.

Uploaded by

venkatesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

// JavaScript source code

//bind this function to the onLoad Event


function howdoyousetvaluesordata(executionContext) {

try {
var formContext = executionContext.getFormContext();
var formType = formContext.ui.getFormType();

if (formType == 1) { // Create form

formContext.getAttribute("new_loancustomercity").setValue("Bangalore");
}
if (formType == 2) { // Editable form

formContext.getAttribute("new_loancustomercity").setValue("Kadapa");
}
}
catch (e) {
Xrm.Utility.alertDialog(e.message);
}
}

//bind this function to the onChange Event


function howdoyougetvaluesordata(executionContext) {

try {
var formContext = executionContext.getFormContext();
var customerType = formContext.getAttribute("new_customertype").getValue();
//how do get optionset label or text
var customerTypeLabel =
formContext.getAttribute("new_customertype").getText();
//alert(customerTypeLabel);
}
catch (e) {
Xrm.Utility.alertDialog(e.message);
}
}

//just bind this function to the onChange Event


function howdoyousetlabelorOption(executionContext) {
try {
var formContext = executionContext.getFormContext();
var customerType = formContext.getAttribute("new_customertype").getText();

if(customerType =="Individual")
{
//How do you set optionset
formContext.getAttribute("axis_loantype").setValue(1);
}
if (customerType == "Corporate") {
formContext.getAttribute("axis_loantype").setValue(2);
}

}
catch (e) {
Xrm.Utility.alertDialog(e.message);
}
}

You might also like