Dynamics CRM Archives - Page 7 of 15 - - Page 7

Category Archives: Dynamics CRM

[Quick Tip] Get SubGrid View Id using Primary Control or Selected Control for Ribbon button’s enable rule in Dynamics 365 CRM.

Use case: I have two entity Awards and Awards category. We have SubGrid on the Awards entity form for Category with Custom Ribbon button. We want to have the button should be visible on specific view only and below are steps to do so. Step 1: Configure the Ribbon Button Create a Ribbon Button, create a command and enable rule. Added enable to Command and command to ribbon button. To enable rule, create a custom rule and pass the JavaScript and parameter. Step 2: Get View id based on the CRM parameter: Now, Get Subgrid view id by passing the CRM parameter in the custom rule. When CRM parameter is Primary Control When CRM parameter is Selected Control Step 3: Write script for Enable Rule for Custom Ribbon Button. We will write a script that will enable or disable the Ribbon based on the view ID using the above code based on the passed parameter. Result: I have written the enable rule that Button should be visible only on the Active Award Category view: Result View of Current View that we get from the Controls in Web Browser Console App Full Code:

Share Story :

Disable field in Business Process Flow in D365 CE using JavaScript

Use case – Our requirement is to mark field Purchase time Frame disabled in Business process flow on change of disable field(custom field) on opportunity form. Let’s see how we can achieve this Solution – Step 1 – Create web resource with below function- Add header_process before schema name of field. Here schema name of purchase time frame field is purchasetimeframe. And after adding header_process_purchasetimeframe var opportunityCustomization = {     //opportunityCustomization.disableField     disableField : function(executionContext)     {         var formContext = executionContext.getFormContext();         var disable = formContext.getAttribute(“cf_disable”).getValue();         if (disable == true)         {             formContext.getControl(“header_process_purchasetimeframe”).setDisabled(true);         }     } } Step 2: Add this web resource on form load, on Save and on change of the field. And try Output – Hope this helps !

Share Story :

Document Location Merge Duplicate

Introduction: If you have duplicate records, you end up merging the records. What happens to the documents that are present on these records. Solution: We have two Contacts, one with Word “My doc” attachment and other with Word “Test” attachment. When we merge the two records and select C 1 as master record. The record c2 will be set as Inactive and the master record will have two document locations. That is how merge works for Documents. Hope this was helpful!

Share Story :

D365 CRM Data Import Pointers

Introduction: Data Import is an integral part of any Migration or new enviornment. CRM allows us to use Data Management>> Data Import wizard to easily import data from Excel files. Text data is easily imported but for data that is Lookup or Multi Select Option Set, users might face issues. This blog will guide as to how we import Data of different types. Lookup: This type of record actually relates to other entity. We need to first assure that the related record is already in system. Example- If we are importing Account with Primary Contact lookup, we need to be sure that the Contact File is already imported and data is present in CRM. Excel file should have same name that we have for existing record, so that it maps to the correct record. In case where we have deadlock in lookup, like Account has Contact and Contact has Account Lookup, we have to import one file without lookup and then update same with lookup. To be clear we need to upload Account without primary contact, then import Contact with Account and then update Account file with Contact. Multiselect Option Set : To import records with multi-select option set field, we would need to pass the option set labels with semicolon “;” as the separator. We need to take care that none of the labels are misspelled. Date: To upload dates, please check the data format in settings and take care that your Excel data is in same format. Other points: While importing data, Duplicate detection rules might cause records to fail, we need to unpublish, rules that do not satisfy our requirements. Also, It is advised to upload clean data and what better than using highlight duplicate and remove duplicate functionality of Excel. This is all in case of new records, in case you want to update records, download the static worksheet of records from Advance find, make changes and upload the exact same updated file, the data import wizard in this case will not ask for mapping, if it does recheck your steps performed.

Share Story :

Change Business Process Flow Based on Form Type Using Java Script.

There are situations where you might need different business process flows based on the form type you choose let us take an example. Consider you want a Business Process flow on the lead entity Such that Lead form will show –BPF with stage Discover, Demo, Propose Sales Lead form will show – BPF with stage Discover, Requirement Gathering, Qualify The case be achieved by doing the following. Lets begin with the implementation. Solution – Step 1: Make a Solution for your customizations and add the lead entity in your solution. Step 2: Make 2 main forms for the lead entity namely “Lead form” and “Sales Lead form” Step 3: Go to process – > Add a new process -> names It Lead creation. Step 4: In the same solution under lead entity add a field of type single line of text namely “Form Type”. Step 5: Add this new field on the lead form and the sales lead form. Note : This field will carry the form type of the form hence will be kept hidden and locked on both the forms. Step 6 : Next step is to get the form type in our form type field to achieve this we will use a web resource that      is a java script code Step 7 : By doing so we successfully bring the form type written in our single line of text field. Step 8 : Next step is to create a business process flow in the solution go to process and make a new business process flow. Step 9 : The above snapshot shows the business process flow to achieve the functionality here the create stage we take the form type as a parameter this is then passed to the condition to check the form type Step 10 : So, if the form type is Lead form it will be true and take business process flow for lead form. Step 11 : Else it will be false and will take the business process flow for the sales lead form. Note: – Make sure to add the business process flow as an entity to the solution and select the form and the business process flow in the site map of the app designer. Java Script code : (Onload of the Form) ChangeBPFByType = (executionContext) => {     debugger;     try {         let formContext = executionContext.getFormContext();         const selectedFormName = formContext.ui.formSelector.getCurrentItem().getLabel();         const getFormIdFromTxtBox = formContext.getAttribute(“cfs_formtype”).getValue();         //formContext.getControl(“header_process_cf_leadform”).setVisible(false);         if (formContext.data.entity.getId() == “”) {             formContext.getAttribute(“cfs_formtype”).setValue(selectedFormName);         }         else {             var getAllForms = formContext.ui.formSelector.items.get();             let navigateFormGuid = “”;             for (var i = 0; i < getAllForms.length; i++) {                 if (getFormIdFromTxtBox == getAllForms[i]._label) {                     navigateFormGuid = getAllForms[i]._id.guid;                     break;                 }             }             if (getFormIdFromTxtBox != selectedFormName) {                 formContext.ui.formSelector.items.get(navigateFormGuid).navigate();             }         }     } catch (e) {         alert(“Something went wrong please try again later”);     } } Hope that helps.!

Share Story :

Change ‘Lookup For’ in Party list Using JavaScript

Introduction: Party list like “TO” usually contain record of type Accounts, Contacts, Knowledge Articles, Leads, Users If you want to restrict the Lookup values, write the below script on load on the form and also on change of the partly list Here for each value in fieldlist, the lookup for will be set to account. This is not applicable to “FROM” as it has OOB restrictions.

Share Story :

Disable field on Click of Button in D365 CE using JavaScript.

Use Case – One of my requirements is to disable the field on click of button Reopen Project on Project form. Let’s see how we can achieve this. Solution – Create Web resource and add below function: Here my function name is “markFieldsReadOnly“. Create Solution in CRM which contains only a single entity on where we have button called “Reopen Project”. Open same solution in XRM Toolbox -> Ribbon Customization.          In Order to get form Context from Ribbon, Pass CRM Parameter – Primary Control  Select Library which is your web resource and add Function Name and publish. Hope this helps!

Share Story :

Let’s get started with Azure Function for Dynamics 365 CRM: Part 1

In this blog, we will learn how to create an Azure Function App to connect it with Dynamics 365 CRM and perform the CRUD operation in Dynamics 365 CRM. First, we will create an Azure Function project for Dynamics 365 CRM from Visual Studio, and below are the steps for the same. Open Visual Studio and create a new Azure Function Project. Filter platform as Azure, select Azure Function, and click on Next. Name your project and click on Create button. After clicking on Create, you will get the below screen where you need to select the Trigger and Azure Function v1 (.Net Framework) and click on Create. In my case, the Azure Function trigger will be Http Trigger which means when an azure function will receive an HTTP request it will trigger. Your Azure Project will be created and the following will be the structure of the project. Now, we will create Azure Function to connect with the Dynamics 365 CRM we need to add the required NuGet Package [Microsoft.CrmSdk.CoreAssemblies]. To add the NuGet Package right-click on the Project and click on Manage Nuget packages. Add Microsoft.CrmSdk.CoreAssemblies in your Project. Following is the code to connect the Dynamics 365 CRM. Currently, we are going to use the credential by specifying them in the C# Code or you can use it as constant. Later in the series, we will learn how to use Environment Variable and pass the credential more secure way in Azure Function using Azure Key Vault. [Stay tuned..!!] Now, select the code and Refactor the code and make the connection function that will return the IOrganizationService if the connection is established else return null. Now, the final code will be as below: Now, we will create a customer with a Hardcoded name when the function is triggered with an HTTP request. Update the existing code with the below code: Testing: We will require the API testing tool, here I am using Postman and the following is the link to download “Postman”. https://www.postman.com/downloads/ To test the application, click on the Start button on top of Navbar as mentioned below in the screenshot [Button will have Project Name]. It will take a few minutes to Load the Azure Emulator Following is the screen you will be able to see and copy the URL highlighted in the red below and paste that URL in Postman. Open the Postman and click on the create a new tab; Select request as POST and paste the URL: After pasting the URL, click on Send You will get the following response on the Azure Function Tool and Postman If there any error or issue with the Azure Function code, the request will be failed and will be displayed on both Azure Function Tool and Postman [Status will be “4**” or “5**” ] Now, we will take look at Dynamics 365 CRM environment and check whether the account is created or not. We are justing getting started with Azure Function for Dynamics 365 CRM and stay tuned for more in this series. Upcoming blogs 1. How to use Dynamics 365 Credentials securely using Azures Function. 2. How to create Dynamics 365 integration with Third-party Applications. Many more……

Share Story :

Change Currency format in D365 Customer Engagement

In this blog we will see how we can change the currency format in D365 CE. We are using the Currency field named Price on Account form and we wanted to price in XX,XX,XXX.XX format Let see how we can achieve this. Solution: Go to Settings and click on Personalization settings. After clicking on Personalization setting, In Set Personal Options click on Format. Click on Customize -> in Number, Digit group change the format as per requirement. After updating click on Apply and Ok. In our requirement, we wanted currency in XX,XX,XXX.XX  format on Account Entity. Price field Before Changing – Price field after changing –

Share Story :

Track an Entity record form opening / retrieve activity by system user in Dynamics 365 CRM

If you want to track a user who has opened records of any specific entity then you are on the right blog because today we are going to see how we can do simple customization to track the user activity of who has open which record for how many times. Step 1: Create an Entity to track the log of retrieve activity of the registered entity. Following are fields in the entity to track user activity tracking activity 1. Name — Logical name of Retrieved Entity. 2. Record Id — Record Id of that Retrieved Entity. 3. No of Time Retrieved — Stored number of times a user has retrieved that specific record. Step 2: Create a Plugin to create a Retrieved Log record The record will be created or updated whenever the user opens the entity form to check details and the following is code for the same. Explanation: 1. When the plugin will trigger it will check if the retrieved log of that record is already present or not. 2. If retrieve records is not present it will simply create a log record with the following details a. Name — Type of records which user has opened [Entity] b. Record Id — Record Id of record which user has opened c. User — which the user has opened the record. d. Count = 1 3. If the retrieved record is already existing in the system then it will increment the count of the number of times a user has retrieved that record by 1 so that we can track how many times the same user has open that specific record. Step 3: Register the Plugin on Retrieve of Entity on entities for which you want to add tracking. Retrieve: It will trigger whenever an entity form is open by any user. While registering the new step for the plugin please make sure that Run in User’s Context must be “Calling User” so that we can have a track that which user has opened which record. Note: All security roles which are given to the user should have read, create and update right to “Entity Tracker” Entity. Also, the stage of execution of Plugin and execution mode must be “PostValidation” and “Asynchronous” so that it will not affect any system jobs and it can run in the background process. If you want to track a retrieve activity of opportunity then you just need to register the new step and select Primary Entity as an opportunity as I have already done for Account and Contact. Now, your system is ready to track the user’s entity retrieve activities, and you will see the following records: Using the above record you can create any type of custom charts and put them in your admin dashboard or you can create a Power BI report to track activity. I hope this helps you, if yes please like the blog. And, the next blog will be on the dashboard & charts based on our Entity Tracker records so stay tuned for that!

Share Story :

SEARCH BLOGS:

FOLLOW CLOUDFRONTS BLOG :


Secured By miniOrange