Posts

DYNAMICS 365 CALL WORKFLOW FROM JAVASCRIPT AND C#

Image
In another post, we saw how to call custom actions from JavaScript and C# . In this post, I will show you how to call workflows from JavaScript or C# and to accomplish this, you need two parameters: The Workflow Id that you want to call AND The Record Id that the workflow will be executed against For the sake of the demo, I created a workflow that will set the Account Name field to: WF Called and Updated From JavaScript after calling the workflow from JavaScript WF Called and Updated From C# after calling the workflow from C# Below is the end result after calling the workflow in JavaScript Below is the end result after calling the workflow in C# ...

DYNAMICS 365 HTML WEB RESOURCE WEB INTERFACE VS UNIFIED INTERFACE

In this quick post, I will talk about two differences between the Web Interface and the Unified Interface when opening a HTML Web Resource in a new window . These two differences are: Refresh the D365 opener of the html web resource Close the opened html web resource In the Web Interface, we normally use the below functions to achieve the needed action: Refresh the D365 opener: opener.location.reload(); Close the opened html web resource: window.close(); However, with the arrival of the Unified Interface, slight changes started to arise, especially for the JavaScript. Some of them are for the above actions. Using the same JavaScript functions for the Unified Interface will not work. Fortunately, we c...

DYNAMICS 365 HOW TO FILTER OPTION SET IN CLASSIC WEB INTERFACE AND UNIFIED INTERFACE

Image
I will talk about an issue when adding options to an option-set field using JavaScript. Therefore, in this post, we will see how to filter Option set fields in Web Interface and Unified Interface . The issue will appear in the Unified Interface when: The option-set field is used in the Web Interface AND the Unified Interface The option-set field is added to the form header The options are added dynamically using JavaScript In my below example, I am using two option-set fields I added the fields to the entity form and the header form I added a JavaScript function on change of the Parent Option Set field to filter the Child Option Set based on the selected option ...

DYNAMICS 365 HOW TO FORCE RECALCULATE ROLLUP FIELDS

In this quick Blog post, we will see how to force recalculate Rollup fields in JavaScript and C# using the below functions. Recalculate Rollup field in JavaScript (for account entity) function reCalculateRollupField(entityPluralName, recordGuid, rollupFieldName) { recordGuid = recordGuid.replace("{", "").replace("}", ""); var requestUrl = Xrm.Page.context.getClientUrl() + "/api/data/v9.0/CalculateRollupField(Target=@tid,FieldName=@fn)?@tid={'@odata.id':'" + entityPluralName + "(" + recordGuid + ")'}&@fn='" + rollupFieldName + "'"; var HttpReq = new XMLHttpRequest(); // Double Check the API URL HttpReq.open("GET", requestUrl, true); ...

DYNAMICS 365 HOW TO SWITCH BETWEEN UNIFIED CLIENT INTERFACE (UCI) AND CLASSIC WEB INTERFACE

Image
Due to many questions in the Dynamics community on how to switch between the new Unified Client Interface (UCI) and the Classic Web Interface , I decided to write this post to show you how to do it. In the new V9 version, the default interface will be rendered in the Unified Client Interface; however, many users still prefer the original one and need to switch back to the classic web interface. You have two options to switch between the new Unified Client Interface (UCI) and the Classic Web Interface From the advanced settings section Click the Settings gear icon > Advanced Settings Click Settings > Administration > System Settings ...

DYNAMICS 365 HOW TO RETRIEVE MORE THAN 5000 RECORDS IN C#

Image
In this post, you will see how to retrieve more than 5000 records from CRM/D365 entities in C# . To do this, I imported thousands of records into the contact entity Created a console application From the Main method, called the two methods: RetrieveMultiple : It will use the Service.RetrieveMultiple request RetrieveMultipleRequest : It will use the RetrieveMultipleRequest message Ran the console application that will give the below result The RetrieveMultiple method is limited to retrieve 5000 records maximum and will look as follows. public string RetrieveMultiple() { EntityCollection objCollection = new EntityCollection(); ...

DYNAMICS 365 FILTER LOOKUP FIELD BASED ON N:N RELATIONSHIP

Image
How to filter a Lookup field based on a N:N relationship of a parent entity using JavaScript . To show you this, I will use the Account entity, the Contact entity, and a custom entity Conference . The contact entity has a N:1 relation with the account entity (lookup field) The contact entity has a N:1 relation with the conference entity (lookup field) The account entity has a N:N relation with the conference entity (sub-grid) I need to filter the conference lookup of the contact entity to list The conference records that are related to the contact parent account or The conference records that are not related to any account Based on the above conditions, the users will not be able to ch...

DYNAMICS 365 MOVE RIBBON BUTTON FROM ONE TAB TO ANOTHER

Image
In this blog post, I will explain how to move a ribbon button from one tab to another. Our victim will be the Run Report button on the Account entity views. However, this can be applied to any other button whether it is displayed on a View, Form, or Sub-grid. The main purpose of this modification, is to increase the User Experience by saving one additional click to execute any action especially if it is frequently used. Problem Whenever you want to click Run Report button (in a view, form, or sub-grid), you have to select the record(s), click the (...) button, click Run Report button, and finally click on the report to be generated. Solution The below steps will guide you to change the location of the button in order to be directly clickable when the user selects a record(s) in a view. Install the Ribbon Wor...

DYNAMICS 365 HOW TO EXECUTE WORKFLOW ON THOUSANDS/ALL RECORDS

Image
Do you have a situation where you want to run a workflow for thousands or all records of an entity in Dynamics 365 ? If yes, then this post will help you to achieve it. In CRM web client, you can run a on-demand workflows for only 250 records per entity, but, there is a workaround to overcome this limitation... using "Bulk Workflow Execution" plugin in XrmToolbox. Based on a FetchXml query, you can now use the "Bulk Workflow Execution" plugin to retrieve records from CRM/D365 entities, select a specific on-demand workflow, and run the selected workflow on those records. To accomplish this, you need to follow the below steps: Create a on-demand workflow to retrieve the records based on your needs For the sake of this demo, we will create a simple workflow on Account entity and add an Update step ...

DYNAMICS 365 V9 ADVANCED FIND ASSOCIATION WITH OPERATOR DOES NOT CONTAIN DATA

Image
One of the interesting feature that Microsoft added in D365 V9 is Contains Data & Does Not Contain Data options in the Advanced Find related records. The purpose of this feature is to have the ability to search for records that are not related to child records. For example: Accounts with no Cases, Contacts with no Tasks... and any other similar needs. In previous CRM versions, we were not able to do this directly in the Advanced Find; but now, it is feasible and so easy through Advanced Find . Example 1 (Contains Data) : Show all Accounts that have Cases linked to them In D365 V9 environment, open the Advanced Find Select Accounts in the Look for option Under the Fields...

DYNAMICS 365 HOW TO DEBUG A PLUGIN USING PLUGIN PROFILER

Image
Often, you might face issue that it is not clear and you are not able to solve it due an error being raised in your plugins triggered. Therefore, you are obliged to debug the plugin in order to troubleshoot and solve the problem. In this post, you will learn how to debug your plugin of Dynamics 365 environment using Plugin Profiler in the Plugin Registration Tool. Below are the needed Step by Step procedure to debug a plugin Installing Plugin Profiler Open the Plugin Registration Tool From the menu, click Install Profiler to install it Once the installation is done, you will get a notification ...

DYNAMICS 365 HOW TO USE UNDER AND NOT UNDER OPERATORS

Image
Since the introduction of the hierarchical structure feature in CRM, querying the hierarchical data has become an interesting way of retrieving info. For this purpose, new conditional operators called "Under" and "Not Under" are added in Advanced Find . To check this functionality, the below hierarchy sample will be used between the accounts records wherever it is located in the hierarchy These conditional operators can be used in one of the below locations: Advanced Find In the Advanced Find window, Look for Accounts In Select > Fields , choose Account In the list of operators, Under and Not Under operators exist in the list ...

DYNAMICS 365 WORKFLOW DEACTIVATED AFTER CRM SOLUTION IMPORT

Image
PROBLEM After importing a CRM solution to a new environment and this solution contains a workflow with a Send Email step, the import is completed but with warning that the process cannot be automatically activated. REASON In a workflow, you added a Send Email step When you click on Set Properties button, scroll down to the Additional Fields tab and you will notice that the Currency lookup field is filled with the Base Currency (noting that this field is useless here) You add the workflow to a solution, export it, and import it in a new environment Now, if the currency specified in the workflow Send Email step does not exist in the new environment, the import will be completed, but, with a warning ...