Preferred Solution in Dataverse | Power Platform Admin Center

By default, everything goes inside a Default Solution if you are aware of the classic way of doing Customization in Dynamics 365 CRM. And this causes components to be lost in Default solution without knowing who created where and what was that.

Hence, to be able to collect all the components created outside of Solutions, Preferred Solution is a great way to automatically add components created outside Solution in a single solution to ensure accountability.

Let’s see how this works with help of this simple post!

Mark a Preferred Solution

Given you have appropriate rights like System Administrator or System Customizer, you can go to the Maker Portal (https://make.powerapps.com/), and follow the steps below –

  1. In the Power Apps Maker Portal, when you navigate to Solutions – you’ll see a message saying ‘Set your preferred solution’ and on the right hand-side show that the Common Data Services Default Solution is already preferred [You’ll know this from Customizations option in classic UI].

    And on the top, you’ll see button to Set preferred solution.


  2. Now, when you select to set preferred solution, you’ll see all the unmanaged solutions you have.
    Select the one you want to mark as Preferred for anything not directly added to a solution.

  3. Then, you’ll see that Preferred Solution label has been applied for that Solution.

  4. Now, even if you add anything directly from other areas like Tables and add a field (for example), it’ll end up having the Prefix of the Solution itself.


  5. In this example, it’s add Field 2. The Prefix set for the Preferred Solution was “cf301

  6. And when you open the Preferred Solution itself, the component you created outside the solution will be added to the Preferred Solution automatically.


  7. This way, it’s easy to not lose any customization in Default Solution and makes it easy for all the components which were created outside of the solution to be gathered in place when you want to investigate your environment!

Hope this was useful!

Thank you!

Pass Entity parameter from Power Automate Flow to an Action

Let’s say that you want to run a Power Automate Flow on a set of Dataverse records and those records will be referenced in your C# Plugins.

And the next steps is you’ll create an Action for this and register it in the Plugin Registration Tool.

In case you are new to plugins in CRM, you can refer this series – Plugins Development in Dynamics 365 CRM for Beginners | [Blog Series]

Bound Action in CRM

Let’s suppose you are aware on how to create Actions in Dynamics 365 CRM. This is an old concept since many years and I’m also assuming you know how to profile a plugin (which is registered as an Action in CRM) –

  1. When you open an Action, let’s suppose you are passing Account as well as a Contact Entity to the Action itself.
    Notice that the Action is registered as a Bound Action on the Account entity already.


  2. Also, assuming that you have Activated this Action and then registered this Action as a Step on the Plugin in the Plugin Registration Tool.


    Now, let’s see how we can pass the parameters to the plugin itself from the Flow

Power Automate Flow – Bound Action

You must’ve used the Dataverse connector a lot, so here’s how you can call the Bound Action and pass the Entity parameters to the Action itself –

  1. You’ll need to use a Perform a bound action action in Power Automate which is offered by Dataverse connector.

  2. Then, select the Table which you have registered the Action on in CRM and you’ll then see the Action’s backend name appear for selected, then pass the primary key of the record.

  3. Now, since there are 2 Entity parameters to be passed for the Action, here’s you’ll see all the fields from those Entity itself!

  4. For each of these Entity parameters, you have to look for the Primary Key field of those tables and then pass the GUIDs of the Entity records you presumably have.

  5. But wait! There’s a limitation here. You can only have 1024 parameters saved for the step selected. Hence, only 1 lookup will suffice.
    You’ll get the below error when trying to set both the Lookups that I’m passing to the action above.
    The error says “The dynamic schema response from API ‘commondataserviceforapps‘ operation ‘GetMetadataForBoundActionInput‘ is too large, only schemas with at most 1024 properties are supported.

  6. Hence, I’ll go back and remove 1 Entity parameters just for this example to work!

  7. And then, I’ll simply profile the Plugin Action to see what is passed in the InputParameters.

Plugin Context

Now, given that you might have already Profiled the plugin and attached it to the Plugin Registration Tool process, let’s examine the context’s Input Parameters –

  1. the InputParameters in the plugin’s execution context will contain the following parameters, which we’ll see in later section of this blog post.
    Target [EntityReference, in a CRUD operation registered plugin step – Target is an Entity in the plugin context]
    AccountRecord [Entity]

Considerations

Here are some considerations if you want to make design decisions for your implementation –

  1. Cannot have 2 or more Entities as parameters as the Perform a bound action step itself has limitations of 1024 properties at the Power Automate level.
  2. Pass some other Entity than the Action you have registered on since you’ll get the registered Entity as EntityReference itself in the “Target” parameter.

Hope this was useful!

Thank you!

Read Excel File from SharePoint Online and create Records in Dataverse | Power Automate Flow

One of the most common scenarios is to be able to pick an Excel spreadsheet from a SharePoint Document location and create records in Dataverse.

There are several ways to do this. But, one of the most common scenarios could be to use Power Automate Flow and use Excel Online and SharePoint Online connectors to perform this operation!

Scenario

Here’s the scenario which you can expand on and fit the same according to your Use Case –

  1. There’s a file in a SharePoint Document location called as AccountImport.

  2. This file has some Account information that needs to be inserted in Dataverse
    Here’s the Excel content which has a Table in it.


  3. And this data needs to be Inserted in Dataverse [You can either Automate this Flow, Make it On Demand — based on whatever is suitable for you]


    Let’s create an On-Demand Flow in order to pick this File and then insert into Dataverse.

Power Automate Flow

Here’s the Power Automate Flow which we’ll create. For the same of this example and to keep it simple, we’ll create an On-Demand Flow –

  1. Create an On-Demand Flow in Power Automate [You could even choose to run the Flow when a SharePoint file is created or changed or even to Run the Flow once every day — depending on what best suits your case]
    Then, look for the action called as List rows present in a table from Excel Online connector

  2. In this Action, you can select what SharePoint Site is to be selected where you have the File in the Document Location.
    Also, then select the Document Library where the Documents reside. That’s the ideal place where you would want to place your Documents.
    Finally, select the File itself by navigating from the Folder icon on the File property as shown below.


    And then select the File once you find it.

  3. Once you have selected the File, the Table itself will be available to pick up from the Table property. Make sure to convert the Excel data into a Table.

  4. Now, once all the Properties are set on the List rows present in a table action, select a For Each loop in the Flow.
    And in the Inputs, give value (List of Items) from the List rows present in a table action which we just completed above.
  5. Once this is set, select Add a new row action from the Dataverse connector in order to create the records sequentially in Dataverse.

  6. Here, map the Columns to the fields in Dataverse. Firstly, select the Table in Dataverse you want to insert these records into.
    Then, select the fields from the Excel which the Excel connector itself separated out for you.

  7. Once you complete all the Fields from the Excel to the Dataverse connector.
    Save and Test the connector itself.
    This will create the records in Dataverse (Dynamics CRM)


    And it’ll Run in a few moments and succeed if everything goes right.



Dataverse Records

Now, let’s see the Flow in action –

  1. Because this is an on-demand Flow, you can Run it whenever you want. And when it Runs successfully, records in the Dataverse will be created as shown below


Hope this helps!

Here are some Power Automate posts you want to check out –

  1. Select the item based on a key value using Filter Array in Power Automate
  2. Select values from an array using Select action in a Power Automate Flow
  3. Blocking Attachment Extensions in Dynamics 365 CRM
  4. Upgrade Dataverse for Teams Environment to Dataverse Environment
  5. Showing Sandbox or Non Production Apps in Power App mobile app
  6. Create a Power Apps Per User Plan Trial | Dataverse environment
  7. Install On-Premise Gateway from Power Automate or Power Apps | Power Platform
  8. Co-presence in Power Automate | Multiple users working on a Flow
  9. Search Rows (preview) Action in Dataverse connector in a Flow | Power Automate
  10. Suppress Workflow Header Information while sending back HTTP Response in a Flow | Power Automate
  11. Call a Flow from Canvas Power App and get back response | Power Platform
  12. FetchXML Aggregation in a Flow using CDS (Current Environment) connector | Power Automate
  13. Parsing Outputs of a List Rows action using Parse JSON in a Flow | Common Data Service (CE) connector
  14. Asynchronous HTTP Response from a Flow | Power Automate
  15. Validate JSON Schema for HTTP Request trigger in a Flow and send Response | Power Automate
  16. Converting JSON to XML and XML to JSON in a Flow | Power Automate

Thank you!

Perform a changeset request in Dataverse connector in Power Automate

You must’ve noticed Perform a changeset request in the Dataverse connector in Power Automate.

Purpose of this Action is to perform batch of available Dataverse connector actions successfully or rollback the batch performed inside this changeset request.

Here’s what it does.

Perform a changeset request

Here’s how to use the connector action

  1. Select Perform a changeset request in the Dataverse connector Actions list.

  2. Now, since this works like a batch of operations to perform all actions successfully or “rollback” operations, you’ll see this working like a Scope but only for Dataverse actions.

  3. You have the below Actions available to perform.

  4. Now, let’s design an example changeset batch here.
    First, I’ll create an Account and then a Contact.

  5. When this Flow runs, for example, if the Contact creation fails, the Account creation too will be rollbacked unlike having these steps outside of the “Perform a changeset request” action.



  6. Please note that the Outputs of the Changeset request itself or even within the steps within a changeset request cannot be captured or referred to in Dynamic Content.

Hope this helps!

Authenticate Dataverse connector using Service Principal in a Power Automate Flow

Many times, users/admins are not comfortable using their credentials being used as Connections. Some connectors do provide the ability to authenticate using Service Principal.

Let’s jump into this! 😊

Setting Up App Registration for Dynamics 365 CRM

Here’s how you setup an App Service to be used as a Service Principal for Dataverse connector in Power Automate –

  1. Go to the Azure Portal (https://portal.azure.com/) and the look for Azure Active Directory.

  2. In Azure Active Directory, look for App Registrations in the menu.

  3. Now, create a + New registration record.

  4. Now, give this App Registration a suitable name. And you can select your preferences on how the tenant type should be. I’ve left it to Single tenant or simplicity of the example.

  5. Now, once this is created, go to the API Permissions section.

  6. Now, look for a button to Add a permission.

  7. Then, select Dynamics CRM and select it.

  8. Once this is selected, you’ll get to select user_impersonation. Then, clicked Add permissions.
  9. Once added, you’ll see that the Status column is blank. Then, click on Grant admin consent for <TenantName>.

  10. Once you click on Grant admin consent button, you’ll be asked for confirmation. Confirm the same.

  11. Once you confirm, you’ll see the status as Granted as shown below.

  12. Then, go to Certificates and secrets. Once in that, click on + New client secret.

  13. You’ll be asked the the Description, do so and Save it.

  14. Now, you need to copy the value onto Notepad.

  15. Now, let’s move to adding this App Registration to the Power Platform Admin Center so that you can then give appropriate permissions so that it can be used for Authentication into Dataverse.

Add Application User in Power Platform Admin Center

Go to the Power Platform Admin Center (https://admin.powerplatform.microsoft.com/) and the to the Environments section and select the correct Dataverse environment –

  1. Select the environment which will have your Flow that will use the Dataverse connection in question.
    And click Settings.

  2. Now, expand Users + permissions section and look for Application Users.

  3. Now, in Application Users, you’ll need to add the App Registration as a User and give Roles. Now, click on + New app user.

  4. Now, click on + Add an app.

  5. Now, any App Registration that has not yet been created in the current environment as user will automatically appear. Select the one you created – “Dataverse Service Principal” in this case and click on Add.

  6. Now, select the BU.

  7. Next, click on Security Roles’ pencil to give roles.

  8. I’m just giving System Administrator for simplicity of example.

  9. Now, you should be good to create this user. Click on Create.

  10. Finally, your Application Record will look like this –

  11. Now that your Application User is set in Dynamics / Power Platform Admin Center, you are all set to add this to authenticate the Dataverse Connector in Power Automate. Let’s do that!

Authenticating using Service Principle in Dataverse action

Now, let’s say you are starting a Flow with the Dataverse connector –

  1. Select the Dataverse trigger you want to use. I’ll pick a common one.

  2. Now, click on the three dots and look to add a new Connection if it already authenticated using the logged in user which is the default behavior.

  3. Now, you’ll see the option to select –

  4. Now, you’ll see these fields to fill in.

  5. Now, first give the connection itself a suitable name.

  6. Now, for Client ID – Go to the App Registration in Azure and look for the Client ID in the information section. It’ll look like this –


    Paste it in the Client ID field and it’ll look like this –

  7. Now, look for Client Secret – open the Notepad where you saved the Secret we copied while creating the Client Secret record in Azure.

  8. Now, finally – Go to the App Registration record and you’ll find the Tenant ID here –


    And paste is where it says Tenant. Now, Create this connection!
  9. Ensure that the Connection is selected.

  10. I’ll just add an extra variable in order to save this simple Flow and then we’ll create an Account (simple example if you see the screenshot below) in order to Run this Flow.
    My Flow looks ready to be tested.

  11. Now, I’ll create an Account in my Dynamics 365 CRM.

  12. And the Flow would have Run already.

Validate

In order to ensure the connection is run by the Service Principal itself, you can do this –

  1. In advanced options, you can choose to “Run as” as “Flow owner


  2. And when you check the details in the Flow Run, you can check the attribute in the trigger “RunAsSystemUserId

  3. And if you check this GUID, it belongs to the Dataverse Service Principal user we set up.


    And that’s how you can setup to run the Dataverse action to use Service Principal instead of user credentials!

Hope this was useful!

Here are some Power Automate posts you want to check out –

  1. Select the item based on a key value using Filter Array in Power Automate
  2. Select values from an array using Select action in a Power Automate Flow
  3. Blocking Attachment Extensions in Dynamics 365 CRM
  4. Upgrade Dataverse for Teams Environment to Dataverse Environment
  5. Showing Sandbox or Non Production Apps in Power App mobile app
  6. Create a Power Apps Per User Plan Trial | Dataverse environment
  7. Install On-Premise Gateway from Power Automate or Power Apps | Power Platform
  8. Co-presence in Power Automate | Multiple users working on a Flow
  9. Search Rows (preview) Action in Dataverse connector in a Flow | Power Automate
  10. Suppress Workflow Header Information while sending back HTTP Response in a Flow | Power Automate
  11. Call a Flow from Canvas Power App and get back response | Power Platform\
  12. FetchXML Aggregation in a Flow using CDS (Current Environment) connector | Power Automate
  13. Parsing Outputs of a List Rows action using Parse JSON in a Flow | Common Data Service (CE) connector
  14. Asynchronous HTTP Response from a Flow | Power Automate
  15. Validate JSON Schema for HTTP Request trigger in a Flow and send Response | Power Automate
  16. Converting JSON to XML and XML to JSON in a Flow | Power Automate

Thank you!

Remove attachments from Dynamics 365 CRM Notes using Power Automate | Dataverse

If you are looking to remove or delete the attachments from Notes (Annotation entity) in Dynamics 365 CRM / Dataverse (and not delete the Note itself), hopefully this will help!

Disclaimer: I’m not covering ‘how you can save your attachments elsewhere’, I’m only covering how you can delete from Notes given that you have handled your attachments before deleting them.

Identifying Attachments

Here are some points which will help you identify once attachments are included when you create a Note in Dynamics 365 / Dataverse.
Note that these are not in Attachments entity.

  1. You can have a Flow that is triggered on the create of a Note (annotation) in Dataverse.
    So here, the Document is Note is attached on a Note.


    And the Trigger of the Dataverse connector in Flow is on the create of a Note

  2. And when the Note is attached, the triggerOutputs body will show this data that denotes the attachment on the Note.

Clearing Attachments

Here’s how you can clear the attachments from the Notes (by not deleting the actual note). If you want to move to SharePoint, it’s a recommendation, but that’s not something I intend to cover here (Assuming you are doing something with the attachments and then wanting to delete them) –

  1. Now, in this example, I’m attaching a Note which will be further cleared using the Update step which I’ll show.


  2. Here’s an update step I have on the same Note which will set the Document Body & Name to null in order to clear the attachment.



  3. To test this, I had another Flow which is triggered on the update of the Note i.e. the step above.
    Once there’s nothing in the Document (documentbody), the filesize will be 0 & isdocument flag to false automatically. Also, setting the Name to Null is important – Else, you’ll still see the attachment on the Note (Just that you can’t open it)


  4. And when you refresh the Timeline, you’ll see that the attachment is now removed.

Hope this was helpful! Here are some more Dynamics 365 posts which you might be interested in –

  1. Enable SharePoint Online integration Dynamics 365 | Power Platform Admin Center
  2. Dynamics 365 Storage Utilization | Dataverse Storage | Power Platform Admin Center
  3. Use Hierarchy in Roll Up Fields in Dynamics 365 CRM
  4. Filter records in a View owned by a Team you are a member of | Dynamics 365 CRM
  5. Get GUID of the current View in Dynamics 365 CRM JS from ribbon button | Ribbon Workbench
  6. Dynamics 365 App For Outlook missing on SiteMap in CRM? Use shortcut link [Quick Tip]
  7. Import lookup referencing records together in Dynamics 365 CRM | [Linking related entity data during Excel Import]
  8. Excel Importing Notes (Annotation) entity in Dynamics 365 CRM
  9. Enable/Disable the need to Approve Email for Mailboxes in Dynamics 365 CRM CE
  10. Call Azure Function from Dynamics 365 CRM using Webhooks
  11. Show Ribbon button only on record selection in Dynamics CRM
  12. Accessing multiple occurrences of a field in Business Process Flow using JS in D365 CRM

Thank you!!

Configure Dataverse Search in Power Platform Admin Center | Dynamics 365

Relevance Search in Dynamics 365 CRM recently got renamed to “Dataverse Seach” as you might have seen some updates.

Here’s how to configure the Dataverse Seach in the new Solutions Explorer!

Scenario

Now, in case you search on the Global Search bar for a record and the table which it lies in doesn’t show up – In this case table I’m looking in is ‘Subscription’ – that means that this entity is not configured for Dataverse Search

Dataverse Search

Here are some points on the Dataverse Search –

  1. Dataverse search is enabled directly is you are opted in to 2021 Wave 2 Updates on your environment.
    Go to https://admin.powerplatform.microsoft.com/ and open the desired environment’s Features section from Settings.


    You’ll find that Dataverse Search is already ON.



  2. Now, navigate to https://make.powerapps.com/ to configure the Dataverse Search for a specific entity.
    Go to Solutions and look for the Solution which has your entity
    In this example, I’ll use the custom entity I’ve created called as ‘Subscription’

  3. In any solution which has this entity, I can click on Overview on the left.


    And then if you look at the right hand side – click on Manage Index


  4. It’ll show the entity which is not enabled for Search – But, notice that it is unchecked – means it is not enabled.



    Now, enable and save it




Check if Table is enabled for Dataverse Search

  1. Enable the Table for Search Results. Now, when you are in the Solution in the new Solution Explorer – Look for the Table. In my example, it is Subscription table.
    I’ll open the Settings of the Table.


  2. In the Settings of the Subscription table, you’ll need to expand the Advanced options.


  3. Now, scroll below and you’ll see the option for Appear in Search Results is enabled.



  4. And once this is enabled, the results will show up in Dynamics 365

Indexed Columns

Now, here’s how to understand the count of Indexed columns. Limit of 950 columns is imposed in a Dynamics 365 environment.
Refer Microsoft’s Official Post – https://docs.microsoft.com/en-us/power-platform/admin/configure-relevance-search-organization#select-tables-for-dataverse-search?WT.mc_id=DX-MVP-5003911

  1. Here’s a snippet from the above mentioned Microsoft Docs to show the count of Indexed Columns calculated towards a Dataverse Search

Hope this helped!

Here are some more Canvas Power Apps posts you might want to check –

  1. Transition effect on Gallery Items when hovered over in a Canvas Power App | [Quick Tip]
  2. Navigate Screen automatically based on Timer in Canvas Power App | Power Platform
  3. Search on multiple columns from a Dataverse table in a Canvas Power App Gallery control | Power Platform
  4. Call a Flow from Canvas Power App and get back response | Power Platform
  5. Enable Custom Code Components (PCF Controls) to be imported in a Canvas Power App | Quick Tip
  6. Retrieve Hashtags from Text in a Canvas Power App | Power Platform
  7. Rich Text Control for Canvas and Model-Driven App | Quick Tip
  8. Setting Correct Default Mode for Forms in a Canvas App | [Quick Tip]
  9. Rating Control to represent data from Dataverse in a Canvas Power App | Power Platform
  10. Clear a field value & Reset Form in a Canvas Power App [Quick Tip]
  11. Get Dynamics 365 field metadata in a Canvas App using DataSourceInfo function | Common Data Service
  12. Implement character length validation in a Canvas Power App | Power Platform

Thank you!