Saturday, December 7, 2024

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

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

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

var empCountry = formContext.getAttribute("min_country")?.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 (empCountry !== null && empCountry !== undefined)
{
    formContext.getAttribute("min_country1").setValue(empCountry);
}

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.

 

 

Tuesday, October 15, 2024

What Is XrmToolBox, How To Download And To Login Into XrmToolBox

See the below screenshot as per XrmToolBox is having definition.

1. To download XrmToolBox open the below link.
    https://www.xrmtoolbox.com/

2. Click on Download Latest Version.

3. It will download the Zip file. Extract the Zip file and open the XrmToolBox app.

4. Once it's open click on Not Connected from the left side of this window and click on Create New Connection 






5. Now give your environment URL and entered the User Name and Password.




6. Click on Next and give your connection name like Dev, UAT and Production environment connection.

7. Now your connection is ready to use. Please connect to your connection and go to open Tool Library  to install required tools into your XrmToolBox, like Plugin Registration Tool, Data Transporter, FetchXmlQuery Builder etc.

8. Here I want to install Plugin Registration Tool, so I search for it and clicked on install button. See the below screenshot.



Friday, October 11, 2024

How To Register The Plugin Step

The plugin steps needs to be created after plugin registration is successful. Open your Plugin Registration Tool OR open you Plugin Registration Tool from XrmToolBox.

Follow below steps to register the Plugin steps.

1. Go to your registered Plugin DLL => Select your Plugin class => Right click on it => Select the Register New Step

2. In the this new window fill the information as below.

A. Message: Messages are mentioned the event of your plugin like Create, Update, Delete, Associate etc.
B. Primary Entity: Primary Entity mentioned on which entity/table your plugin code will be execute.
C. Event: Here Eventing Pipeline Stage of Execution are mentioned at where your plugin code will be execute like Pre-Validation, Pre-Operation and Post-Operation. 


How To Register Dynamics 365 CRM Plugin

 1. Open Plugin Registration Tool and Signing into it. Here I am opening it from XrmToolBox.

2. Click on Register and select the option of Register New Assembly

3. Once you click on it below window will be open. Here you have to select your Plugin DLL. Click on 3dot as below window screenshot.

4. Select your Plugin DLL from your project folder => Bin => Debug => Select your DLL file => now click on Open button.

5. Now here you have select your Plugin classes to register and click on Register Selected Plugin



Create Dynamics 365 CRM/CE Plugin Step By Steps

 Follow below steps to create Dynamics 365 CRM Plugin.

1. Open your Visual Studio, here I am using 2019, Once you open you will see right side option as Continue without code, click on it.

2. Click on File tab New => Project.

3. In the search window Class Library and select the Class Library (.NET Framework), see the screenshot below and click on NEXT.
4. Now give your Project name and other details as below. and click on Create.
5. Now Visual Studio is open go to Solution Explorer. Here you will see all your Plugin project components. Right click on References => Add Reference => Browse => Go to Your Plugin Registration Tool folder and select the following DLL.
A. Microsoft.Xrm.Sdk.dll
B. Microsoft.Xrm.Sdk.Proxy.dll
C. Microsoft.Xrm.Tooling.Connector.dll

6. Inherit the IPlugin interface to your Plugin class. Once you add it's using Microsoft.Xrm.Sdk.dll reference, add those reference and implement interface. Over the mouse cursor on IPlugin then you will see it.


7. Now add the below common of the plugin as below inside the Execute method.

// Obtain the execution context from the service provider.  
            IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

            // Obtain the IOrganizationService instance which you will need for  
            // web service calls.  
            IOrganizationServiceFactory serviceFactory =
               (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));

            IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

            // Obtain the tracing service
            ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));

            // The InputParameters collection contains all the data passed in the message request.  
            if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
            {
                // Obtain the target entity from the input parameters.  
                Entity accountEntity = (Entity)context.InputParameters["Target"];

            }




8. Sign the assembly. Right click on your project into Solution Explorer => click on Properties
9. Go to left side Signing tab. Check the checkbox Sign the assembly  

10. click on New.

11. Give you signing name (name my anything as per your logic).

NOTE: As of now Plugin is supporting dot net framework 4.7.1 version. If you don't have then download it from below URL and install it. Once it's install re-start your system/laptop and set the Framework to 4.7.1



Rebuild your solution.
Now you plugin code is ready. You have add your logic after the line number 32.

How To Download Plugin Registration Tool

 The Plugin Registration Tool are used to register the plugins and register the step of plugins.

Follow below steps to download the plugin registration tool.

1. Create one folder into your system any drive folder name as: Dynamics_365_Plugin_Tools

2. Open Windows PowerShell from your Windows Start Menu
 



3. My folder name is Dynamics_365_Plugin_Tools and it's into C drive. Default Windows PowerShell set to C drive. put the below line.
                                       

4. Once Directive change then add/past the below code and press enter.
                                      

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$sourceNugetExe = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
$targetNugetExe = ".\nuget.exe"
Remove-Item .\Tools -Force -Recurse -ErrorAction Ignore
Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExe
Set-Alias nuget $targetNugetExe -Scope Global -Verbose
##
##Download Plugin Registration Tool
##
./nuget install Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool -O .\Tools
md .\Tools\PluginRegistration
$prtFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool.'}
move .\Tools\$prtFolder\tools\*.* .\Tools\PluginRegistration
Remove-Item .\Tools\$prtFolder -Force -Recurse

5. Once you press enter you will see the download starting window as below.


6. Once it's completed go to you folder you will see the one folder with name Tools  open it and you will one more folder with name PluginRegistration open it now you will all your Plugin Registration Tool .dll files and Plugin Registration Tool option.






What Is A Column In Dynamics 365 CRM?

 In This Post we are going to Explain