Perform actions on the host model-driven form from embedded canvas app using ModelDrivenFormIntegration control in Dynamics 365

Let us continue our previous example of embedding the canvas app within the model-driven app and extend it to perform actions on the host form using ModelDrivenFormIntegration control.

This ModelDrivenFormIntegration control acts as a bridge and brings the contextual data from the host model-driven form to the embedded canvas app.

Here we will look at some of the pre-defined actions that can be performed using the ModelDrivenFormIntegration Control.

For this update our existing Canvas App and add the below buttons to the Form control in the canvas app

  • Save Form

For the Save Form button, first, create the flow (Power Automate) which will update the record.

https://nishantrana.me/2019/11/04/step-by-step-calling-flow-from-powerapps-dynamics-365-ce-crm/

 

Below we are calling the Flow from Save Form button and passing GUID of the record along with values of name, city and phone field.

Here we have used ModelDrivenFormIntegration’s Item property to retrieve the id of the account record in our formula that is being used to call the Flow (Power Automate)

Result

updating the address 1 city field by appending text “Redmond” in the embedded canvas app.

save

  • Refresh Form

The true and false parameter value of the RefershForm method specifies whether to show prompt or not before saving any unsaved data on the host form.


Result

refreshing the form, shows the address 1 city field of the form in the right section with the appended text “Redmond” as saved earlier.

refresh

  • Navigate to Main Form

NavigateToMainForm method’s parameters are entity name, form name, record id.


Result

Here we are opening the same record.

navigatemain

  • Navigate to View

NavigateToView method’s parameters are entity name and view name.


Result

Opens the view specified in the parameter

NavigateToView

  • Open Quick Create Form

NavigateToView method’s parameter is entity name.


Result

Opens the quick create form of the entity specified in the parameter.

Get all the details here 

Hope it helps..

Embedding a canvas app on a model-driven app in Dynamics 365

Let us start with some of the key points about the embedded canvas app

  • The embedded canvas app is now generally available. During preview.
  • The embedded canvas app supported sub grid control in preview, which is now no longer available.
  • The canvas app custom control is only supported for the Unified Interface Web client type. It doesn’t support Phone and Tablet client types.
  • We can only have 1 canvas app on the form. We can have multiple embedded canvas app but only 1 of them could be enabled.
  • It is recommended to have an embedded canvas app on a required field else it will not refresh on any change in the data on the host model-driven form.
  • The embedded app can only be created from the host model-driven form.
  • The existing canvas app cannot be used as an embedded canvas app.

To create the canvas app custom control, select the controls tab in the Field Properties dialog, and click on Add Control.

Select Canvas app in App Control dialog.

  • The Canvas app will have Web client selected as default and Phone and Tablet option will be greyed out.
  • Entity Name shows the name of the field that is associated with it.
  • App ID will be populated when the app is created.

Clicking on Customize opens the PowerApps Studio.

We can see the canvas app form control added to the canvas app.

We can see the fields for city, name, and phone already added to it.

ModelDrivenFormIntegration is a special control that is responsible for bringing the contextual data from the form to the embedded canvas app.

Using Edit Fields option, we can add, remove, edit, reorder the fields of the data source.

Just for the simplicity let us keep the app as it is.

Click on File à Save à The cloud (Save to PowerApps)

On a successful save, we can see the App ID generated.

Uncheck Display label on the form, save and publish the customization.

Changing the value in the Phone field in the form and saving the form changes the value inside the canvas app form control.

To Edit the canvas form control, we need to follow the same steps, open the field properties, controls tab and click on Customize

After making the changes inside PowerApps studio, save and publish the changes.

The other Dynamics CRM User say poweruser2 will get the below error message when they open the same form if the app is not shared with them.

The app can be shared with specific users, security groups or everyone within the organization. The users should have appropriate security roles to access the entities and also appropriate permissions on the cloud services that are being used as part of the canvas app.

There are no privileges specific to the canvas app within Dynamics 365 CE

To share the app, Navigate to File and select Share option

Here we searched for the user, made him Co-owner and assigned security roles which will give him access to Accounts entity.

We can see the embedded canvas app rendered properly in this case for the poweruser2

In this post, we covered some of the key points about the embedded canvas app along with steps to create, update and share it (although we just used the OOB generated app here),  I would recommend to check out the videos by Shane Young to learn about PowerApps and different scenarios that we could implement.

Hope it helps..

Step by Step – Calling Flow from PowerApps (Dynamics 365 CE/CRM)

Let us take a simple example of creating lead to understand how we can call Flow from PowerApps.

Log in to PowerApps Studio and create the form as below.

  • TextInput for entering the Last Name, First Name and Email ID.
  • Button to call Flow.
  • The label named GUID which will display the GUID of the created lead record.

Now select the button, go to Action menu and click on Flows to create a new flow.

Click on create a new flow.

Select Instant – from blank option

Select PowerApps as the trigger.

Add a new Step – Create a new Record (Dynamics 365)

To create a new record step, specify the Dynamics 365 Organization Name, select Leads as the entity name.

For the Last Name field, click Ask in PowerApps that will generate the parameter to which we will pass the value from our PowerApps.

The generated parameter.

Repeat the above step for the First Name and Email field.

*for Topic field we have passed a hardcoded value.

Save the create step and add a new step “Respond to a PowerApp or flow

Here we have selected output of type Text

We have added the output parameter as varLeadId and selected leadid as the unique identifier.

Save the Flow and navigate back to PowerApp and select the flow created for our button.

After adding the Flow, the next step is to update the formula to send the field’s value to the flow and also to receive the output from it.

Below will be our formula to pass the text to the flow.

But as we are expecting the GUID in return, we need to update it.

We are using the Set function to set the variable varResponseFromFlow with varleadid output.

Also, we have updated the label field for GUID with the variable

Now let us save the changes and run the PowerApp.

On clicking the button, we can see the GUID updated on the label on the form.

Back in our Dynamics 365 CE, we can see the lead created.

Thus we saw how easy it is to write a PowerApp which interacts with Dynamic 365 CE using Flow. We took a very basic example to understand how things glue, but we can clearly see the potential here to implement complex real-world scenarios with ease.

Hope it helps..

Using PCF Custom Control Builder (XrmToolBox Plugin) to update existing control in Dynamics 365 / PowerApps

A couple of months back I had written my first PCF Control to display GUID of the record, it was more of a hello world kind of thing.

https://pcf.gallery/guid-control/

Well, the code was using Xrm.Page client API which as we know is deprecated.

So, it was time to update it to use context instead.

More on context

So, thought of using the wonderful PCF Custom Control Builder tool to do that by Danish (which got a new update today – 22- Oct-2019)

Connect to the organization, select Edit existing PCF Control option

Specify the Control Location and VS Command Prompt Location (VsDevCmd.bat)

And click on Reload Details which will list down the details of the component and the solution as shown above.

Click on Open in VS Code to open the project in Visual Studio Code and start making the required update.

It opens the project in Visual Studio Code.

i.e.

Here let us update the index.ts file to use context to fetch the GUID.

Save the changes. And click on Build

i.e.

Now click on Test to see it in action or to debug.

We can see it populating the GUID

To debug it à we can use the developer tools (F12) and put the breakpoint in the index.ts file.

Now let us deploy it to our organization

Deployment in action

After successful deployment, we can see the solution added to our organization

Now let us use it for the single line of the text control.

Publish the changes.

Create the new lead record and we can see the GUID of the record created in the control

Thus, the wonderful PCF Custom Control Builder plugin of XrmToolBox makes it so easy to update the existing PCF Control and also to create new PCF Control.

Hope it helps..

Out of preview – New Model-Driven form designer (WYSIWYG) in PowerApps

Finally the new model-driven designer is out of preview and available for general use

https://powerapps.microsoft.com/en-us/blog/announcing-the-general-availability-of-the-new-model-driven-form-designer/

Since I wrote about it last the few changes that we can see are

  •  New Field button that allows adding Lookup Fields. However I still don’t see the option of Option Set fields there.

Form

  • Grouping of Components Section

Form

  • Preview for the components

Form

Looking forward to see all the remaining features that are part of our classic Form Designer like addition of Business Rules, Show Dependencies, Enable Security Roles etc. to be part of the new designer.

Below are the previous blog posts that I wrote about the new model driven apps while it was still in preview –

https://nishantrana.me/2019/08/19/subgrid-quickview-linear-gauge-arc-knob-linear-slider-controls-added-in-new-model-driven-form-designer-wysiwyg-in-powerapps/

https://nishantrana.me/2019/08/05/sub-grid-added-to-the-new-model-driven-form-designer-wysisyg-in-powerapps/

https://nishantrana.me/2019/05/27/few-improvements-in-new-model-driven-form-designer-wysisyg-preview-in-powerapps/

https://nishantrana.me/2018/12/24/the-new-model-driven-form-designer-wysisyg-in-powerapps-for-model-driven-apps-dynamics-365-ce-preview/

Hope it helps..

Subgrid, QuickView, Linear Gauge, Arc Knob, Linear Slider controls added in new model-driven form designer (WYSIWYG) in PowerApps

Recently we were trying out the model-driven form designer and noticed the option of adding new input control to the form in it.


Few days back only I wrote about the addition of Subgrid control, however the limitation was that we couldn’t add new subgrid control. But with the new updates, we can now add new subgrid control along with Quick View and other controls also as shown below.

The other option to configure these controls is from the Controls tab of the field properties dialog box.

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/customize/use-custom-controls-data-visualizations

Hope it helps..

Sub-Grid added to the new model-driven form designer (WYSISYG) in PowerApps

Hi,

Microsoft is steadily adding all the essential features to the new model-driven form designer (preview) making it more and more usable and intuitive.

Latest addition is the support for sub-grid as shown below

The properties window for the sub-grid

`

We can select the view from either the related entities or view from any of the un-related entity (uncheck Related Records check box).

Similarly, we can enable view selectors and can show all the views or selected view as shown below.

We still can’t add new sub-grid to the form in the new form designer, for that we still need to go back to our classic form designer.

Check out below articles for more details –

https://docs.microsoft.com/en-us/powerapps/maker/model-driven-apps/form-designer-overview

The new model-driven form designer WYSISYG Editor

Few improvements in the new model-driven form designer.

Hope it helps..

Apply SLA choosing the SLA in the SLA lookup field for the SLA Enabled Entities in Dynamics 365 CE

One of the enhancements that came in SLA (CRM 2016 Update 1), which I feel has got unnoticed by few, is choosing the SLA manually using the SLA lookup field.

As we all know SLA comes already enabled for Case Entity and can be enabled for the below entities

Account, Contact, Order, Invoice, Quote, Opportunity, Lead, Activity Entities.

Basically, the above entities have SLA lookup field already created for them.

We can also Enable SLA for custom entities and activities, which will create the SLA lookup field in it.

Add the field on the form and select the appropriate SLA, and that selected SLA will be applied to that record.

It saves us from defining multiple SLA Items for an SLA to be applied as DEFAULT or to use the entitlements to achieve the same.

Hope it helps..

Single Organization vs Multiple Organization (Single Instance vs Multiple Instance) key points to consider in Dynamics 365 CE (On-Premise)

The decision for going with single or multiple organisation should be made as early as possible because if the implementation grows, it will increase the complexity. For e.g., if we have Marketing already implemented for the marketing lob and now, we are planning to add Sales and Service, which would be difficult as it could require updating the existing implementation (plugins, workflows, BPF, Security Model, Business Unit structure, etc.) to cater for addition of new LOBs. If the implementation of the system is designed from the very beginning keeping different LOBs in mind, the complexities can be managed. Also, there is a possibility that a single instance which is serving different LOBs, needs to be separated to multiple instances later, this again will require additional efforts.

Below are some of the factors and pros and cons that we would need to consider before deciding on Single Organization vs Multiple Organization (Single Instance vs Multiple Instance).

Companies with Business units \ LOBs having a different set of customers and different
functional area with no need for

  • cross-business collaboration
  • sharing of data
  • unified or roll-up reporting
  • the same set of standardization

will benefit from Multiple Organization or Multiple Instance approaches.

The benefits of Multiple Organization or Multi-Instance are

Reduced complexity when it comes to the designing and implementation of the data model and security model.

Having less volume of data stored in the system could contribute to improved performance of the application.

Having a lesser number of customization (plugins/workflows/business rules etc.) without segregation logic for different LOBs could also contribute to improved performance.

Provides autonomy, so easy to implement new features/functionalities/3rd party applications without having to consider the impact of it for other business units.

Easy and efficient release management e.g. fast deployment, lesser downtime and do not have to be agreed upon for all the LOBs, less need of regression testing, etc. with fewer teams/functionality being impacted.

Fewer chances of exceeding organization limits for e.g. we have following limits in Dynamics 365 CE /CRM – 100 rollup attributes and each entity having 10 rollup attributes, 10 activated business process flow per entity, maximum number of entities that can have active SLAs is 7, maximum number of SLA KPIs allowed per entity is 5 etc.

System-level settings through Administration à System Settings could be easily governed, managed and defined for the single organization without affecting other LOBs for e.g. some of the settings like – Decimal Precision Point, Relevance Search or Categorized Search, Using legacy form rendering, Session Timeout, Audit settings, etc.

For Customerflexibility to have different implementation team (partners/vendors) working on separate organizations (administration, implementation, support, etc.)

Also, if there are any regulatory or compliance that has to be in place for one LOB it would adversely affect other LOBs in case of the single instance as essentially, they’d be sharing the same resources.

On the other hand, companies having Business Units with the need for coordination and sharing information/data having process standards, rollup reporting needs will benefit from a single organization or single instance approach.

Rollup and Unified reporting and cross-business unit collaboration can be achieved easily in case of a single organization as all their information would be residing in the same instance’s database without any need of User Interface Integration/ SQL Server Replication / Web Service Integration / Publish/subscribe pattern by plugin-ns.

Check out the whitepaper here

https://www.microsoft.com/en-us/download/confirmation.aspx?id=36056

Most of the 3rd party applications in App Source like ClickDimensions supports only single instance, so different LOBs part of that same instance can share it, which will not be the case of multi-instance, as it would require separate licenses to be procured.

Required common functionalities would still need to build/deployed into multiple organization i.e. less reuse of configuration and code, which can be easily shared and standardized in case of singe organization.

No need for data replication or information (customer, contact, etc.) to be duplicated in all the instances in case of multi-instance.

For multi-instances in case of Online, there would be an additional cost associated with adding instance (sandbox and production).

Also, additional cost in case of multi-instance, for procuring any 3rd party application for each of the instance that needs it, increased integration/ replication cost.

For multi-organization in case of CRM On-Premise, there could be added infrastructure cost to support that many organizations.

Multi instance/organization can also plan to use the Hub and Spoke strategy. This would be recommended approach in case of independent but similar LOBs (e.g. located at different region/geography) i.e. replication.

https://blog.westmonroepartners.com/implementing-dynamics-crm-on-an-enterprise-wide-scale-using-a-hub-and-spoke-strategy/

Few important factors to be considered are as below

Ownership Cost – Who within the organization/enterprise is paying and owning the CRM System.

Does the organization have a Global Center of Excellence (CoE)?

There is no denying that having a single instance service multiple LOB(s) will have added complexity which will only grow with time as the implementation progresses (enhancements/ phases), does the organization has the plan or a roadmap clearly defined to handle it with all the stakeholders involved aligned with Enterprise strategy and architecture.

Please feel free to add your thoughts, suggestions and insights in comments.

Hope it helps ..

What is the maximum file size limit for Attachments in Dynamics 365 \ On Premise V9?

Recently was trying to figure out the maximum file size limit for the attachments.

It is 131072 (in kilobytes)

Can be defined at Settings – Administration – Email Tab.

Scroll down to Set file size limit for attachments section

MaxSize

Hope it helps..