Tuesday, November 26, 2024

Read And Write The Dynamics 365 CRM TwoOption Field Using Java Script

Follow below code to read and write the Two Option field of Dynamics 365 CRM.

1. To Read the value:
Below code are read the Name field value and store into areYouINterested variable.

var areYouINterested = formContext.getAttribute("min_areyouintersted").getValue();


2. To Set/Update value:
Below code will be check the Name field contains data, if it contains then set/update the areYouINterested1 field value.

if(areYouINterested !== null && areYouINterested !== undefined)
{  formContext.getAttribute("min_areYouINterested1").setValue(areYouINterested);
}

Read And Write The Dynamics 365 CRM Single Line Of Text Field Using Java Script

 Follow below code to read and write the Single Line Of Text field of Dynamics 365 CRM.

1. To Read the value:
Below code are read the Name field value and store into empName variable.

var empName = formContext.getAttribute("min_name")?.getValue();


2. To Set/Update value:
Below code will be check the Name field contains data, if it contains then set/update the Name1 field value.

if (empName !== null && empName !== undefined)
{
    formContext.getAttribute("min_name1").setValue(empName);
}

Friday, November 15, 2024

Read And Write The Dynamics 365 CRM Lookup Field Using Java Script

 Follow below code to read and write the Lookup field of Dynamics 365 CRM.

1. To Read the value:
Below code are read the Name field value and store into org variable.

var org = formContext.getAttribute("min_organization")?.getValue();
    var orgid = org[0].id;
    var orgname = org[0].name;
    var orgentityname = org[0].entityType;;


2. To Set/Update value:
Below code will be check the Name field contains data, if it contains then set/update the address1 field value.

if (org !== null && org !== undefined)
{
  formContext.getAttribute("min_organization1").setValue([{ id: orgid, name: orgname, entityType: orgentityname }]);
}

Monday, November 11, 2024

Execution Context In Dynamics 365 CRM/CE And How To Pass It To the Java Script Function

Execution Context is passing the complete information and data of the record to the Java Script function, From this execution context you can get the information of the form by using the getFormContext() method.

To use this executionContext you have to declare java script function with one parameter as executionContext.
If you want tot perform the operation on Form data you have to get the Form Context from this executionContext as executionContext.getFormContext()


To pass this executionContext from the form you have to check the checkbox as :
Pass execution context ass first parameter.

From Classic View Form:
Open the form => Form properties => Add Event



From Power Apps View Form:

Open the form => Events => Open Event Handler.


Sunday, November 10, 2024

Read And Write The Dynamics 365 CRM Multi Line Of Text Field Using Java Script

  Follow below code to read and write the Multi Line Of Text field of Dynamics 365 CRM.

1. To Read the value:
Below code are read the Name field value and store into empAddress variable.

var empAddress = formContext.getAttribute("min_address")?.getValue();


2. To Set/Update value:
Below code will be check the Name field contains data, if it contains then set/update the address1 field value.

if (empAddress !== null && empAddress!== undefined)
{
    formContext.getAttribute("min_address1").setValue(empAddress);
}

Java Scripts Form Events Of Dynamics 365 CRM/CE

 In the Dynamics 365 CRM entity/table form level there are three 3 types of Events.

There are 2 events are related with Form and 1 event are related with Field. Open the form from classic window. Click on Form Properties.

Form Events:

Field Event:

1. OnLoad : This event will fire when you load your form or open your record. 

2. OnSave : This event will fire when you save your form.

3. OnChange : This event will fire when you change any field values.


Below screenshot for Form events from Power Apps.


Saturday, November 2, 2024

How To Create Your Java Script Function And Web Resource

 To used java script you have to create a web resource and functions. Follow below steps to create script web resource and function.

Creation of Java Script File:

1. Open VS Code and Visual Studio => Write the below code, Here I am using VS Code Editor.

2. Now save this file as java script => press ctrl+s to save this file on VS Code Editor and save it as below screenshot.

3. In the Download folder one java script file is created with name "D365MyFirstScript"


Creation of Java Script Web Resource:

1. Go to https://make.powerapps.com/  => Solutions => Open your Solution (Here my solution name is Mintech Customization).

2. Click on New => More => Web Resource.

3. In the New Web Resource upload the created Java Script file and fill the all remaining details, as below screenshot.

Now next step to call your Java Script function.


Calling Of Java Script Web Resource Function:

Here I am calling this Java Script function on Account entity form Load.

1. Open your Account entity main form => OnLoad => Event Handler

2. Now add your Web Resource by clicking on Add Library
3. Search of your newly created Web Resource file name and add it.

4. Select your Web Resource and function name as below.

5. Now go to your Account entity and open any record, Here I am open the "A. Datum Corporation" record, Your script will be read the Account name field value and display this value into alert dialog box as below.





What Is Java Script Into Dynamics 365 CRM/CE

 The Java Script are used to perform the client side operations and customizations, by using it you can extend the functionality of forms, views, fields and records. You have to create a custom function to perform the operations. 

Following are the some operations you can perform by using Java Script.

1. Read and Update the forms fields values.

2. Perform the validation operations.

3. Calling the API.


To perform the all above operations you have to create a java script web resource and functions.

 

 

What Is A Column In Dynamics 365 CRM?

 In This Post we are going to Explain