Use JavaScript to add onchange event to a field in the Business Process Flow


Let us continue our previous post, here we will update the script to add an onchange event to the Identify Sales Team field in the Business Process Flow. Based on the value selected we will make the Develop Proposal field mandatory.

A screenshot of a computer

Description automatically generated

Below is the code we need to add for it.

A screen shot of a computer program

Description automatically generated
function OnLoad(executionContext)
{
	 var formContext = executionContext.getFormContext();
	 formContext.data.process.addOnStageChange(CheckStageAndToggleFieldBPF);
	 CheckStageAndToggleFieldBPF(executionContext);
}

 function CheckStageAndToggleFieldBPF(executionContext) {

        var formContext = executionContext.getFormContext();     
        var activeStage = formContext.data.process.getActiveStage();
        var activeStageId = activeStage.getId();		
        var stagePropose = "3a275c22-fc45-4e89-97fc-41e5ec578743";
     
        if (activeStageId.toLowerCase() === stagePropose) {          
                formContext.getControl("header_process_identifypursuitteam").setDisabled(false);                 
        }
        else {
            formContext.getControl("header_process_identifypursuitteam").setDisabled(true);
        }    

		formContext.getControl("header_process_identifypursuitteam").getAttribute().addOnChange(function(executionContext) {

                if (formContext.getControl("header_process_identifypursuitteam").getAttribute().getValue()) 
				{
                    formContext.getControl("header_process_developproposal").getAttribute().setRequiredLevel("required");
                }
                else 
				{
                    formContext.getControl("header_process_developproposal").getAttribute().setRequiredLevel("none");
                }
            });
  }
  
  
  
  

We can add it to the field if it is in the form also, that will also work the same. However, if we do not have the field on the form we need to add it to the field on the BPF.

On selecting the value completed for Identify Sales Team, we can see the Develop Proposal field being set as mandatory.

A screenshot of a computer

Description automatically generated
A screenshot of a computer

Description automatically generated

Later if we add the same field on the form, or into another stage of the BPF, the onchange event will apply and work for them.

For the field on the form –

A screenshot of a computer

Description automatically generated

Same field in another stage –

A screenshot of a computer

Description automatically generated
A screenshot of a computer screen

Description automatically generated

Hope it helps..

Advertisements

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

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

Data Migration of Quote and Quote Product – few key points (Dataverse/Dynamics 365/ SSIS)


Below are the different out-of-the-box statecode and statuscode for the Quote table.

Status (statecode)

Status Reason (statuscode)

0 (Draft)

1 (Inprogress)

1 (Active)

2 (Inprogress)

3 (Open)

2 (Won)

4 (Won)

3 (Closed)

5 (Lost)

6 (Canceled)

7 (Revised)

Now if we are trying to migrate Quote records that are in either 2(Won) or 3(Closed) status (statecode), our package will fail and we will get the below error.

{“error”:{“code”:”0x80040233″,”message”:”Quote can’t be closed because it is in Draft state. Only Active Quote can be closed. Please activate the Quote and then try to close it.”}} -batchresponse_aa072eca-fd15-4067-8f2b-41f7b3dfad1c– )System.Net.WebException

This is because we cannot directly create the Quote record with the status either Won or Closed.

It will create those records with the status Draft instead.

However we can create Quote records with either Draft or Active status, we will not get the above error.

Now another point to be considered is, if we are moving the quote product record also, is that we cannot associate the quote product to a quote if it is in Active or Closed / Won status, it has to be draft status for the quote product to be associated.

If we try adding / associate Quote Product to either an Active or Closed Quote, we will get the below error –

A screenshot of a computer

Description automatically generated

: The remote server returned an error: (400) Bad Request. (Error Type / Reason: BadRequest, Detailed Message: {“error”:{“code”:”0x80043b09″,”message”:”The detail cannot be updated because the parent is not editable.“}})System.Net.WebException (Status Reason: BadRequest): The remote server returned an error: (400) Bad Request.”

And as expected with Draft Quote we can associate quote products.

A screenshot of a computer

Description automatically generated

So basically if we are planning to migrate Quote and Quote Product to Dataverse/Dynamics 365

  • First, move all the Quote with status as Draft (i.e. do not map statecode and statuscode)
  • Then associate Quote Product to it. (also certain fields are only available for update and not create, you could run update Quote Product package to update those fields)
  • Next, we can update all the Quote as Active (along with any other fields that are available only for update and not create), and then run another update package to update the actual statecode and statuscode values as now from the Active status we could move to draft or closed status without any issues.

And also please check the CRM Migration Starter Kit for further details and guidance.

https://www.kingswaysoft.com/blog/2020/12/17/Announcing-Migration-Starter-Pack-v40-for-Microsoft-CDS-and-Dynamics-365CRM

Hope it helps..

Advertisements

Recent and Pinned options are available now for multi-session app’s sitemap (e.g. Customer Service Workspace)


As we would have observed now we have the Recent and and Pinned records option available for the Customer Service workspace app.

A screenshot of a computer

Description automatically generated

The users can see the same Recent and Pinned records while moving between the Customer Service workspace and Customer Service Hub app, giving a consistent experience.

Recent :

Pinned :

Get all the details.

Hope it helps..

Advertisements