2

We are working on a Canvas app that allows user to perform bulk operations such as assigning roles to users, manage privileges, etc. For this, we created a custom connector at the PowerApp that calls the Dynamics CRM Rest API to perform various operations using swagger JSON. The Azure AD tokens have been used for authentication.

To avoid various UI limitations and challenges, we are now planning to switch to model-driven app. Two questions:
1. How can we create a PCF component that consumes/call aforesaid Dynamics CRM rest API?
2. How to embed this component on Dynamics CRM model-driven app, so we can use them in Model-driven apps?

Pratik Bhavsar
  • 808
  • 8
  • 32
  • Arun, already answered the question, but can I ask what specific difficulties are you facing with canvas app. We just created one canvas app and deployed it to production. We are also trying to assign roles and add N:N records and so. – AnkUser Feb 13 '20 at 07:12

1 Answers1

2
  1. How to embed this component on Dynamics CRM model-driven app, so we can use them in Model-driven apps?

If you decided to use PCF as your component instead of web resource, better know the limitations. PCF control can be rendered either as a field control or dataset control which means you are going to replace the textbox or subgrid into something else for visualization.

Documentation says:

- Replace a field that displays a numeric text value with a dial or slider code component.
- Transform a list into an entirely different visual experience bound to the data set like a Calendar or Map.
  1. How can we create a PCF component that consumes/call aforesaid Dynamics CRM rest API?

If it’s web resource, we will simply utilize Xrm.WebApi for calling crm web api within HTML/ js webresource in same context.

If it’s PCF, still crm context will support you like this:

this._context.webAPI
      .retrieveMultipleRecords(TSWebAPI._entityName, queryString)
      .then(........

Learn more: Code Reference

Good thing with both of these approach is, no need of extra authentication or token. As they are running inside CRM, current user context will be used. If you want to impersonate some privileged service account for role assignment, it’s possible too using web api header.

  • Can you please provide some reference links on how any of these methods are achieved? – Pratik Bhavsar Feb 13 '20 at 06:49
  • @PratikBhavsar you can find lot of blogs in internet to walk through it. Can you be specific? – Arun Vinoth-Precog Tech - MVP Feb 13 '20 at 06:53
  • We want to display side navigation, which will be a dynamic tree structure, for example, listing all users from dynamic CRM. Each user will be a navigation item itself. How can we achieve this in power apps canvas? – Pratik Bhavsar Feb 13 '20 at 06:59
  • 1
    @PratikBhavsar ok then you have to develop/find out a tree view control in typescript, bind the user dataset to that control. This is just start - https://powermaverick.dev/2019/05/18/create-custom-controls-using-powerapp-component-framework/ – Arun Vinoth-Precog Tech - MVP Feb 13 '20 at 07:04