Category Archives: D365 Customer Service
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 :
Autosave quick create a form record on fields change and open the created record
Requirement: The user will create the record from the Quick Create and on change of specific field, the record should automatically save. Whenever the record will be saved it should open the created record. In our scenario, we are going to use the Account Entity. When the user will enter the main phone data in the Account Quick Create Form, the record will automatically save and it will open the created account record. Steps: Go to Default Solution or your customization solution and Open the Quick Create Form from Account Entity 2. Click on the Form Properties to edit the form properties of Account Quick Create Form and add the script on the form. 3. Click on the +New button to add the JavasScript web resources on the form so that you can use the script function on Form Events 4. If you wanted to use an existing Web Resource then you add it or else create new by click on new 5. Create a new Script and add it on form 6. Now, we need to add the event list and bind the calling function to it. To do it click on the + New on Event Listener of Form Properties. Note: Please don’t forget to pass the execution context as the first parameter to the function. 7. We will use formContext.data.save() function to get the created record’s GUID and open entity record using that GUID. Following is code for your reference: 8. Code Explanation: a. quickCreateonSave is a function that is trigger on change of Main phone fields of Account Quick Create. b. When the function is triggered we are using formcontext.data.save to save the save so that we can get the GUID of the recently created record. c. On formcontext.data.save() we can assign two functions — on success and failure as parameter to .then() [Reference] d. On Success, the function will return the following response where you can get the entityType, entity id, and name of the record. e. After getting the entity id and entity type, we can use the open form to open the record as mentioned in the Code. 9. Publish all the customization that you have done on the Account Entity Demo: I hope it helps you guys!!
Share Story :
Connect D365 CRM CDS Database from SQL Server
Many times, we feel like why I can’t access D365 CRM Database directly from MS SQL Server, so here is my blog that will guide you on how you can connect D365 CRM CDS Database using MS SQL Server Steps to enable D365 CRM CDS Database to make it connect from MS SQL Server: Login to https://admin.powerplatform.microsoft.com/ using administrator credentials. In Environment section, click on your environment for which you want to enable D365 CRM CDS for MS SQL Server. (In my case I am clicking on DemoEnvironment as shown below.) When Environment opens click on settings in header. Settings page will open, Click on Product and then click on Features. When features Page opens enable TDS Endpoint (Preview) and click save. Now, we have successfully enabled D365 CRM CDS to connect it from MS SQL Server. Steps to Connect CDS Database from MS SQL Server: Open MS SQL Server. In connect to SQL Server Window enter Server name (It will be your D365 CRM URL) followed by comma and Port Number (5558) e.g. of server name yourdomain.crm.dynamics.com,5558. Select Authentication as Azure Active Directory – Password. Enter Username: Your admin user id e.g. admin@xyz.com Enter Password: (Your Login password) ******** Click Connect. Now, you have successfully connected to D365 CRM DB. Write a select query and test if it’s working.
Share Story :
Set Name Format In D365 CRM
Introduction: In some scenarios, we might need that Full name of Contact Person should be Last Name and then First Name. In this blog we will see how to change the Format of Full Name for Contact Entity. Step 1: Go to Advanced settings -> Administration -> System settings Step 2: Open System settings -> you will see Option to select different Name format -> Select Format you want and click OK. Step 3: here is the short Demo: I have created a Contact with First Name as Jon and last Name as Paul Below is the Output: Note : This can not be exported into Solution. I hope this blog will help you to format Contact’s Name
Share Story :
Required Privilege for Canvas App in D365 CRM
Introduction This blog explains how to resolve the issue for Canvas App not loading which is embedded in D365 CRM using HTML Webresource. Issue After Canvas App was published and shared with Users still, they were unable to access the Power App. It was showing a blank page with no error. Resolution After debugging the Webpage, I concluded it was missing the Canvas App required privilege. The privilege can be found in D365 CRM as per below screenshot After creating a new role for sharing Canvas App and assigning to User, Canvas App rendered as below Conclusion I hope the above Blog helps you resolve the issue for Canvas App embedded using HTML Webresource in D365 CRM. Note: This privilege is only required for Canvas App embedded with HTML Webresource in D365 CRM.
Share Story :
Convert Your Complex Workflow to Power Automate with Two Easy Steps
While creating a new Background Workflow, we all have noticed the below message. Microsoft Flow( Power Automate) is a growing platform with a variety of new connectors getting added overtime. However, we all are aware that Workflows have a great capability when it came to including steps like Call Plugins, Workflow Assembly. And thus, when we think of replacing our existing background Workflows with Microsoft Flows, we might worry about losing our existing Plugin Customizations used in Workflow. So, here are a few easy steps to use all the existing Workflow steps in your Power Automate( Microsoft flow). Step 1: Create an Action. Lets take an Example: We had a workflow which triggered on When a Note was created and had the below steps: The first step Notes Collection, was Workflow assembly that was customized to send history all notes in a Tabular Format, and was something we wanted to use in Power Automate and so we created the below Action. The Action has the exact same steps as that of the Workflow. Step 2: Create a Flow with a trigger same as your Workflow trigger and call the action. Once we have created the Action, our goal is to deactivate the Workflow, and call the Action from our power Automate. To do so, we will add the below step: This step is in the Common Data Service(current environment) Connector. Since we have action that belongs to Entity Note, we will create bound action. If we have a global action, which needs no identifier we can add the step- Perform an unbound Action. Conclusion: Any Workflow that runs in background and uses Plugins or steps that you would prefer not to change but to use them directly in your Power Automate, then here’s an easy way.
Share Story :
Resolve the dependency between multiple solutions in D365 Customer Engagement / CRM Solution using Solution Component Mover.
You have might question in your mind that why we need to move the components from one solution to another solution in D365 Customer Engagement So, let’s consider a scenario you and your team is working on D365 CRM customization and created the two solution — ‘ Solution A’ and ‘Solution B’. While customization development when you are moving the ‘Solution A’ on the Production instance but you are not able to move it. Because some of the missing components are present in the ‘Solution B’. Then you have decided to move the ‘Solution B’ first, but again while moving the ‘Solution B’ its failed because of some of the missing components present in ‘Solution A’. It means ‘Solution A’ and ‘Solution B’ are dependent on each other and you can’t move either of the solutions in the Production Environment or Target Environment. There are two solutions to the above problem Add the missing components in the one solution and move that solution to production. Merge the dependent solution into one solution using Solution Component Mover. Now, the First solution is time-consuming as well as effort making and developers need to track all the missing components and add them manually. But using Solution Component Mover, you can merge solutions in 10 to 15 min just by selecting the component from Source Solution and Target solution to which you need to move the components. So, let us see how to do it. Perquisites: XrmToolBox You can download the XrmToolBox from https://www.xrmtoolbox.com/ Steps to follow: Open the XrmToolBox and connect to your D365 CRM environment. Search for the Plugin “Solution Components Mover” Image: Search Solution Components Mover in XrmToolBox 3. Once the plugin will be load, click on load solution — it will load all the solutions present in the Environment. Image: Click on Load Solution After solutions are loaded you can see I have two solutions in my Environment “Solution A” and “Solution B” which have dependent components and one “Target Solution” on which I m going to copy the component so that “Target Solution” will become a master solution. Solution A Image: Solution A has Account entity and it’s subcomponents Solution B Image: Solution A has Case entity and it’s subcomponents Target Solution Image: Target Solution doesn’t have any entity or component. 4. Move the solution component by select the Source solution and Target Solution 5. Click on the Copy component, a popup will open where you can select the component type to move to the target solution. 6. Click on “Ok” and component from both solutions will be moved to Target Solution. You can see the following screenshot in which Target Solution has a component from “Solution A” and “Solution B”. You can see XrmToolBox Plugin how it helps to reduce your time and effort to which are required to move the component from solution to solution manually one by one.
Share Story :
Customize Opportunity Close Dialogue Box
Go to Admin settings. Click on system settings After clicking on System settings, a popup opens, click sales tab as shown below. Select Yes in Customize close opportunity form and click ok, refer below image.
Share Story :
Choose which All Records To Create While Qualifying Lead
Go to Admin settings Click on system setting After clicking on System settings, a popup opens, click sales tab as shown below. Now, select no for Qualified lead experience refer below image.
Share Story :
Share Records in D365 CRM by Code
Introduction: This blog details steps how to share entity record in D365 CRM by Code. Scenario: We have client requirement to share record with multiple set of Users in D365 CRM based on criteria selected by User on Form and needed to be automated. Implementation Step: Below code to be developed for OnCreate of record. Create new method ShareRecords private static void ShareRecords(IOrganizationService service, Entity entity, Entity segmentUser) { var CreatedReference = new EntityReference(“systemuser”, segmentUser.Id); var grantAccessRequest = new GrantAccessRequest { PrincipalAccess = new PrincipalAccess { AccessMask = AccessRights.ReadAccess | AccessRights.WriteAccess | AccessRights.AppendToAccess, Principal = CreatedReference }, Target = new EntityReference(entity.LogicalName, entity.Id) }; service.Execute(grantAccessRequest); } Retrieve User List of Users and execute ShareRecords method EntityCollection segmentUsers = service.RetrieveMultiple(new FetchExpression(fetchXMLUsers)); foreach(Entity segmentUser in segmentUsers.Entities) { ShareRecords(service, entity, segmentUser); } Below code to be developed for OnUpdate of record. Create new method UnShareRecords private static void UnShareRecords(IOrganizationService service, Entity entity, Entity segmentUser) { var CreatedReference = new EntityReference(“systemuser”, segmentUser.Id); var revokeUserAccessReq = new RevokeAccessRequest { Revokee = CreatedReference, Target = entity.ToEntityReference() }; service.Execute(revokeUserAccessReq); } Retrieve existing shared Users and remove there Access private static void RetrieveSharedUsers(IOrganizationService service, EntityReference entityRef) { var accessRequest = new RetrieveSharedPrincipalsAndAccessRequest { Target = entityRef }; var accessResponse = (RetrieveSharedPrincipalsAndAccessResponse) service.Execute(accessRequest); foreach(PrincipalAccess principalAccess in accessResponse.PrincipalAccesses) { EntityReference prAcc = principalAccess.Principal; Entity entity = new Entity(entityRef.LogicalName, entityRef.Id); Entity segmentUser = new Entity(prAcc.LogicalName, prAcc.Id); UnShareRecords(service, entity, segmentUser); } } Implement code for ShareRecords explained in step 1 & step 2. Conclusion: Hope this blog helps you to to share and unshare records by code in D365 CRM based on custom criteria data on record dynamically.