How to remove contact and customer validation on Cases– Dynamics 365


By default, we can only specify the contact associated with the customer for the case record. If we try specifying a contact record that is not associated with the Customer selected, we will get the below error message.

Invalid Contact – The specified contact doesn’t belong to the account selected as the customer. Specify a contact that belongs to the selected account, and then try again.

Also, CRM will filter the lookup to show only the associated contact record

A screenshot of a computer

Description automatically generated

However, if we do not want this validation, we can remove it using the environment variable.

Search for Customer Entities Relationship For Incidents / msdyn_IncidentShouldValidatePrimaryContact

A computer screen shot of a computer screen

Description automatically generated

Set the new value as 0.

A screenshot of a computer

Description automatically generated

Now we will be able to save the record using an unassociated contact.

A screenshot of a test case

Description automatically generated

Get all the details here

Hope it helps..

Use the new Associated Grid Control to display details of other tables in subgrids – Model-driven App / Dynamics 365


With the Associated Grid Control we can configure and show up four subgrids in the form, making it a more intuitive and cleaner form layout, with ease of navigation.

Below we are adding the Associated Grid Control component to the Contact’s form.

Here we have specified the Subgrid Tables and Views to begin with.

A screenshot of a computer

Description automatically generated

For the 1st subgrid specified we can set the specific options from the properties pane. Here let us try checking the Show related rows properties for the cases subgrid.

On doing so, we get the below message.

It basically reset the 1st subgrid’s table to Accounts from Case, the rest of the configuration remains unchanged.

A screenshot of a computer

Description automatically generated

Let us change it back to Cases and select the appropriate view.

A screenshot of a contact page

Description automatically generated

Let us save and publish the change.

Now in the Contact form we can see the grid control with 4 different subgrids as configured.

The Active Cases shows the associated cases.

A screenshot of a computer

Description automatically generated

However, that is not the case with other subgrids as they show all the records.

A screenshot of a computer

Description automatically generated

To filter it to show the associated records we need to specify the relationship name while configuring the component.

Let us edit the component.

A screenshot of a computer

Description automatically generated

Below we specified the relationship name for the subgrid 2 i.e Accounts.

A screenshot of a computer

Description automatically generated

As expected, this time we can see Active Accounts filtered to show only those account records where the contact is associated as the primary contact.

A screenshot of a computer
Description automatically generated

Get all the details here

Also check –

Due Open Activities Control – https://nishantrana.me/2023/05/09/due-open-activities-control-dynamics-365/

Notes Control – https://nishantrana.me/2023/05/10/notes-control-dynamics-365/

Attachment Control – https://nishantrana.me/2023/05/08/new-attachment-control-dynamics-365/

OptionSet Wrapper Component – Use OptionSet Wrapper component to show color-coded options on the form

Hope it helps..

Advertisements

Use OptionSet Wrapper component to show color-coded options on the form – Model-driven apps/ Dynamics 365


We can make use of the OptionSet Wrapper component to show color-coded options on the form for the choices or option set fields.

Below we have added the Option Set wrapper component to the Rating field of the lead in the Lead (Main) form.

We can see the field added but do not see any colors for it.

A screenshot of a contact form

Description automatically generated

This is because it uses the color defined for that column, which wasn’t defined out of the box for that field.

We then defined the colors as shown below for different choices / options.

After saving and publishing our changes, we were able to see the corresponding color for the choices.

A screenshot of a computer

Description automatically generated

Also check –

Hope it helps..

Advertisements

New Lead Qualification Experience – Dynamics 365 Sales


To enable the new lead experience, navigate to App Settings >> Lead + opportunity management in the Sales Hub App.

A screenshot of a computer

Description automatically generated

On enabling it, we get the option to specify whether the Account, Contact, and Opportunity records are created automatically or the user (seller) has the option to specify which record to create.

We also see the option to Copilot summarizing the case once a lead is qualified.

For opportunity, if we select Seller, we get an additional option to modify the Opportunity form by adding or removing fields and also the option to allow a maximum of 5 new opportunities during lead qualification.

A screenshot of a computer

Description automatically generated

Clicking on the Add or remove fields link opens the Opportunity qualify lead form for customization.

A screenshot of a computer

Description automatically generated

Let us see it in action.

On clicking the Qualify command, we can see the new Qualify lead dialog opened in the side pane.

It gives us the option to create a new Account, Contact, and/or Opportunity record.

A screenshot of a computer

Description automatically generated

For Account and Contact, we can specify an existing record or select none if we do not want the Account and Contact record to be created.

A screenshot of a computer

Description automatically generated

For opportunity, we can click on edit icon to update the details of the opportunity record to be created. It will open the Opportunity qualify lead form.

A screenshot of a computer

Description automatically generated

Similarly clicking on + New opportunity allows us to specify a value for the new opportunity record.

A screenshot of a computer

Description automatically generated

As we had selected the option of a maximum of 5 opportunities, we got the below message on trying to specify the 6th opportunity record.

“You can’t add more than 5 opportunities.”

A screenshot of a computer

Description automatically generated

Let us click on Qualify.

We can see below details, the link to the records generated, and the summary.

A screenshot of a computer screen

Description automatically generated

Clicking on Finish opens the 1st opportunity record. We can also see the summary added to it.

A screenshot of a computer

Description automatically generated

On setting all the options to Automatic,

A screenshot of a computer

Description automatically generated

we can see the below details in the Qualify lead dialog, all as read-only information.

Get all the details here

Hope it helps..

Advertisements

Bypass Power Automate Flows using SuppressCallbackRegistrationExpanderJob optional parameter – Dataverse / Dynamics 365


Using the SuppressCallbackRegistrationExpanderJob optional parameter in our Request object, we can bypass the execution of the flows registered against that particular event/trigger.

We have a flow registered on the update event of the lead record.

Now let us create a lead record through SDK.

A screen shot of a computer code

Description automatically generated

We can see our flow triggered.

A screenshot of a computer

Description automatically generated

Now let us add the optional parameter SuppressCallbackRegistrationExpanderJob and check

A screen shot of a computer code

Description automatically generated

This time as expected our lead record was created but the flow was not triggered.

A screenshot of a computer

Description automatically generated

Also check –

Using BypassBusinessLogicExecution Parameter (Preview) to bypass Custom Sync and Async Logic (Plugin and Workflow)

Bypass execution of specific plugin (step) using BypassBusinessLogicExecutionStepIds parameter

Hope it helps..

Advertisements

Sample Code to create and associate Folder / SharePoint Document Location (Dataverse /Dynamics 365 / SharePoint Online)


Below is our sample record for a custom table custom_contract for which we will be creating the folder in SharePoint and associated it with this record using the SharePoint Document Location record. We’d use the same naming pattern that CRM uses i.e. Name + ”_” + ”GUID”

A screenshot of a chat

Description automatically generated

Below we have passed the details of the record along with CrmServiceClient and SharePoint’s client context.

A screenshot of a computer code

Description automatically generated

The below code will first check if there is already a SharePoint Document Location created by CRM using ends with GUID condition. If it doesn’t exist, we are using the name field plus GUID of the record to create the folder in SharePoint and then associate using SharePoint Document Location record. Also we have used Regex to make sure we replace the special characters with “-“ similar to what CRM does. We are also checking if the Folder exists with that name in SharePoint before creating one.

Below is the GUID / record we have specified while creating the SharePoint Document Location record, the SharePoint Document location configured for that particular table.

A screenshot of a computer

Description automatically generated

The sample code –

  var authManager = new AuthenticationManager(applicationId, certPath, password, domain);
            ClientContext clientContext = authManager.GetContext(siteUrl);

            var serviceClient = new CrmServiceClient(connection);
            if (serviceClient.IsReady == true)
            {
                var myCRMRecord = serviceClient.Retrieve("custom_contract", 
                    new Guid("f655304e-045b-ef11-bfe2-000d3a9b4e06"), new ColumnSet("custom_name"));
                CheckIfShareDocLocationExistElseCreateandAssociate(myCRMRecord, serviceClient, clientContext);
            }

 private static void CheckIfShareDocLocationExistElseCreateandAssociate(Entity myCrmRecord, CrmServiceClient serviceClient, ClientContext clientContext)
        {
            var querySharePointDocumentLocation = new QueryExpression("sharepointdocumentlocation");
            querySharePointDocumentLocation.ColumnSet.AddColumns("name", "relativeurl", "parentsiteorlocation", "regardingobjectid");
            querySharePointDocumentLocation.Criteria.AddCondition("regardingobjectid", ConditionOperator.Equal, myCrmRecord.Id);
            querySharePointDocumentLocation.Criteria.AddCondition("relativeurl", ConditionOperator.EndsWith, myCrmRecord.Id);
            var result = serviceClient.RetrieveMultiple(querySharePointDocumentLocation);
            if (result.Entities.Count == 0)
            {                
                var folderName = myCrmRecord.Attributes["custom_name"].ToString();
                // this makes sure we replace the special characters with - similar to what CRM does when autocreating the record.
                string regexPattern = @"[~#%&*:<>?/\\{|}.""-]";
                string replacement = "-";
                folderName = Regex.Replace(folderName, regexPattern, replacement) + "_" + myCrmRecord.Id.ToString().ToUpper();
                var folderRelativeURL = "custom_contract/" + folderName;

                Web currentWeb = clientContext.Web;
                var folderExists = currentWeb.DoesFolderExists(folderRelativeURL);
                if (!folderExists)
                {
                    var list = clientContext.Web.Lists.GetByTitle("Documents");
                    list.RootFolder.Folders.Add(folderRelativeURL);
                    clientContext.ExecuteQuery();
                }

                var documentLocation = new Entity("sharepointdocumentlocation");
                documentLocation["name"] = "Documents on Default Site 1";
                documentLocation["relativeurl"] = folderName;
                // specifying the GUID of the SharePoint Document Location configured for that table
                documentLocation["parentsiteorlocation"] = new EntityReference("sharepointdocumentlocation", new Guid("cf97e6d8-0b4e-ef11-a317-6045bdd74f46"));
                documentLocation["regardingobjectid"] = new EntityReference("custom_contract", myCrmRecord.Id);
                serviceClient.Create(documentLocation);
            }
        }

The result –

A screenshot of a computer

Description automatically generated

Also refer –

Hope it helps..

Advertisements

Nishant Rana's Weblog

Everything related to Microsoft .NET Technology

Skip to content ↓