Category: Javascripts

Dynamics Option Set - Get/Set the Dynamics 365 Option Set text and values.

Get/Set the Dynamics 365 Option Set text and values.

There are many scenarios where we need to get the option name and value of the option-set field. The below code can be used to retrieve the option name and its values. 1. To get option name from OptionSet Below code can be used to get the option name by passing the option value. 2. To get the text and value of the selected CRM OptionSet Below code can be used to get the text and value of selected optionset: 3. To get the value of selected CRM OptionSet. Below code can be used to get the value of selected

Continue reading
Dynamics-365-Lookup-Field

JavaScript to get/set the lookup value in Dynamics 365.

JavaScript to get/set Lookup field data in Dynamics 365 Let’s discuss about the Lookup field in Dynamics 365 in this blog. Lookup field is little different than the normal fields available in Dynamics 365 CRM. This field is basically of type EntityReference like we generally have array. This EntityReference type is the combination of three values i.e. Recordid, RecordName and  EntitySchemaName. When user create a new lookup field in any entity, then the system will create a N:1 relationship with the other entity. 1. Get Lookup Field Data in Dynamics 365 The below method can be used to get the lookup

Continue reading
custom-lookup-in-dynamics-365

How to create custom lookup view using JavaScript in D365/MSCRM?

Custom Lookup View in Dynamics 365 Sometime there is a requirement to show the filtered records in the lookup field.  In this blog, we will learn how to create a custom lookup view in Dynamics 365 with filtered records using JavaScript. Custom lookup view is used to gather all the filtered data using FetchXML and show it in lookup field of the entity. However, there is no such default functionality available to achieve this requirement. So we have to write a simple javascript code which will set the filtered records in the lookup field. Check the below example of custom

Continue reading
Browsers - How to get client browser type in MSCRM?

How to get client browser type in MSCRM?

There might be a requirement where you need to find out the type of your browser and according to execute some code snippet. The getClient() method can be used to get the type of the browser. It returns a value to indicate which client the script is executing in. Example: //Sample Code function getClientName() { var clientName = Xrm.Page.context.client.getClient(); alert(clientName); } This example returns the value as: Web in case of Web Browser Outlook in case of Outlook Client Mobile in case of Mobile Browser Note: Use getClient() method instead of the removed isOutlookClient() method. Happy CRMing!!!

Continue reading