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

Day 2

The document contains JavaScript functions designed to be bound to events in a Loan Officer form. The functions retrieve and display the record ID, the value of the 'new_loancustomercity' field, and the value of the 'new_loancustomeremail' field using alert dialogs. Error handling is included in the email retrieval function to alert any exceptions that occur.

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)
15 views2 pages

Day 2

The document contains JavaScript functions designed to be bound to events in a Loan Officer form. The functions retrieve and display the record ID, the value of the 'new_loancustomercity' field, and the value of the 'new_loancustomeremail' field using alert dialogs. Error handling is included in the email retrieval function to alert any exceptions that occur.

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

//bind this function to the OnLoad Event of Loan Officer

//executionContext is parameter of functon


function gettingRecordGuid(executionContext) {

var formContext = executionContext.getFormContext();


var formType = formContext.ui.getFormType();

if (formType == 2) {

var recordGuid = formContext.data.entity.getId();//record ID

Xrm.Utility.alertDialog("Record ID is : " + recordGuid);


}

//just bind it to OnSave or where ever accroding to you

function ReadValuefromField(executionContext) {

var formContext = executionContext.getFormContext();

if (formContext.getAttribute("new_loancustomercity") != null) {

if (formContext.getAttribute("new_loancustomercity").getValue() != null) {

var LoanCustomerCity =
formContext.getAttribute("new_loancustomercity").getValue(); // here
new_loancustomercity is the field name

Xrm.Utility.alertDialog("Loan Customer City Is : " + LoanCustomerCity);


}
}
}

// we have to bind the function to the onsave event


function gettingValuefromLoanCustomerEmail(executionContext) {

try {

var formContext = executionContext.getFormContext();

if (formContext.getAttribute("new_loancustomeremail") != null) {

if (formContext.getAttribute("new_loancustomeremail").getValue() !=
null) {

var loanCustomerEmail =
formContext.getAttribute("new_loancustomeremail").getValue();

Xrm.Utility.alertDialog("Loan Customer City Is : " +


loanCustomerEmail);

}
}

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

You might also like