Cards for Power Apps [Preview] | Power Platform

So Cards are finally in Power Apps! As of writing this post, Cards is in Preview in the Power Apps (https://make.powerapps.com/)

Here’s the official page of Adaptive Cards – https://adaptivecards.io/

In case you are new to Adaptive Cards and figuring out how they work with Teams, you can check my post here – Adaptive Cards for Teams to collect data from users using Power Automate | SharePoint Lists

Cards in Power Apps

Here’s how you can start creating Cards in Power Apps –

  1. In the appropriate environment having correct rights, you can see Cards section –

  2. Then, you can click on “+ Create a card” button in the Create section of the menu.

  3. Give the Card a suitable name. In my example, I’m calling it Swag Kit Card. You can name it based on your application/use.

  4. It’ll take a few moments for your card to be created. You’ll see the below dialog while it’s getting created in the backend.

  5. Once the process is completed, you’ll be taken to the Editor itself and this is what it looks like –

  6. And as you can see on the left hand-menu, the controls which you can get are the ones you could see in the Adaptive Cards IO designer.
    In the Data, you’ll see only Dataverse at the time of this being in a Preview release.

  7. In this example, I’ll keep things simple and generate a static card which can be used.

  8. Once I save this card, you can see how the JSON is built out

  9. You can copy the selected part which is expected in the below used Teams action in Power Automate

  10. And as an example, since this Card currently supports for Teams – I can simply copy this from the JSON view and paste it in one of the Actions for Teams i.e. Post adaptive card in a chat or channel.

  11. So, when I Run the Flow, I can get the Adaptive Card show up as a message from Flow Bot.


    And that’s it!!

Accessing Cards in your Environment

All the Saved Cards appear here in the environment –

  1. Navigate the the Cards section in Power Apps and click on Cards.

Microsoft Docs for Cards for Power Apps (preview) – https://learn.microsoft.com/en-us/power-apps/cards/overview?WT.mc_id=DX-MVP-5003911

Hope this was useful! As this continues to evolve in GA, I’ll write more about using Cards in Power Apps.

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!

Format Data by Examples in a Flow [Preview] | Power Automate

Here’s an exciting update users are starting to see in Oct 2022. Is to Format Input data based on examples i.e. generating Expressions instead of writing them yourselves in Power Automate!

At the time of this post, this is in Preview and hence, please consider that this might or might not make it to final release and hence, not recommended for Production use!

Let’s see how this works!

Expressions using Data Samples in Power Automate

Here’s how you can generate Expressions that have been generated from Examples you provide –

  1. In Dynamic Content, go to Expressions, you’ll see the Format data by examples option at the top.

  2. I’m passing Date in the Flow as below –


  3. This will open up a pane on the right hand side to select the data variable for which the expression has to be generated.
    I want to format a Date from the Inputs in a certain way. Hence, I’ll select Date from the Pane which has opened up.

  4. Upon selection, I’ll provide some examples on what values can come in and what should it be translated to.

  5. Here, I’ll enter some examples on how the input date can be expected to which what the output format should be desired.
    Once I provide a few examples, I can click on Get expression for the Flow to generate a custom expression for me based on the examples I provided.

  6. Upon clicking Get expression, the Flow will generate a custom Expression for you which you can test/copy right away.

  7. Note that in the above, the key-button-date is set, you need to set this to the actual field
  8. Here’s an example which I’m testing –


    And it produced the correct result –

  9. So, I’ll click on Apply.

  10. You’ll be asked confirmation before Applying this formatting –

  11. Once you confirm, the Expression will be generated.

  12. And when you test the actual Flow, it’ll expect the value based on how you tested the Expression and produce the result –
    In this case, the key-button-date i.e. the current Date was formatted. Hence, the current date will be returned.

  13. And the answer is as below –


    Hope this was useful!!

Other Examples

Currently, below are the types of formats supported –

  1. Date
  2. Text
  3. Number

Text Example

Here’s a Text based example you can think of –

  1. In a Text based Example, I want only first 3 letters of a City.

  2. Here’s the expression Generated which I can check –


  3. And like the main example above, this expression can be applied!

Number Example

Here’s a quick number example you can think of –

  1. Let’s say you want to format a number in a phone format or currency –

  2. And the expression will be generated for the same –

Here’s Microsoft Documentation on the same – https://learn.microsoft.com/en-gb/power-automate/format-data-by-examples?WT.mc_id=DX-MVP-5003911

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!

Using Environment Variables in Power Automate and Canvas Apps

Here’s how you can use Environment Variables in your environment in Power Automate and Canvas Apps!

In case you are looking to create Environment Variables, here’s the post: Environment Variables in Power Apps and Power Automate

Power Automate

Here’s how you can use Environment Variables in a Flow –

  1. You can’t use/access Environment Variables in a Flow which is not in a solution –
    Environment Variables are accessible in the Dynamic Content section on the very top of the list. [Since the below Flow is outside a Solution, you can’t see the Environment Variables]

  2. Now, this Flow is within a Solution –

  3. And then you access the Dynamic Content, you can see the Environment Variables.

  4. And when you Run the Flow, the Environment Variable will show the value based on the Data Type set for the variable at appropriate places –

Canvas Apps

Unlike Power Automate Flow, Environment Variables in Canvas Apps can be utilized even if the Canvas App was created outside a solution –

  1. In a Canvas App, click to Add Data Source.

  2. On the Environment Variable Definitions/Values is added to the Canvas App as Data Sources, let’s take a simple Text control to read the Value from the Environment Variable used in the above Flow example –
    I’ll use Lookup() function in Power Automate to fetch the value of the Environment Variable by it’s Schema Name
    Even if you only added Environment Variable Values table as Data Source, the Environment Variable Definition too will be added once you use the Lookup() function to fetch the value.

Hope this was useful!

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

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

Thank you!

Environment Variables in Power Apps and Power Automate

Here’s how you can create Environment Variables in Power Apps or Power Automate portal.

Creating Environment Variable in a Solution

First, create Solution to store your environment variable.

  1. In this example, I’m using Power Apps (https://make.powerapps.com/) to create a n Environment Variable.
    In the Solution, I can click on New and then look for an Environment variable.

  2. Below are the types of Environment variables which you can create –


  3. For example, I’m storing the current Org’s ID in an Environment Variable which I want to re-use in my Flow for whatever purpose (Just an example 🙂).
    I’ve given it a suitable name and stored the current value as well.

  4. And my Environment Variable will be created in a Solution in either Power Apps or Power Automate.

  5. Now that your Environment variable is ready, you can feel free to use it in Power Automate and Power Apps. Environment variables can be used in Flows and Canvas Apps which are in a solution.
    Here’s how you can use Environment Variables in Canvas Apps and Flow – Using Environment Variables in Power Automate and Canvas Apps

You can look at Microsoft’s Documentation on Environment Variables for more info – https://learn.microsoft.com/en-us/power-apps/maker/data-platform/environmentvariables?WT.mc_id=DX-MVP-5003911

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!

Calendar Control View in Dynamics 365 CRM | Power Apps

A Read-Only Grid can only always provide you with a static view of data. At times, it’s important to visualize some data in Dynamics 365 which offer more than just columns.

In most common scenarios, your custom records / customizations might have Start End Dates which is better viewed in a visual way. Here’s where Calendar Control comes into play –

Read-Only Grid

Normally, below is how you visualize your data in Dynamics 365 where you have Start Date and End Date –

  1. As you can see, the data looks like in any other entity you’d design.

Calendar Control

Here’s how you can enable the Calendar Control to change the View in question into Calendar Control –

  1. Go to the Entity/Table itself and click on Controls.

  2. Then, look for Calendar Control in the View.

  3. Then, configure the Start Date, End Date, Description, Duration fields.
    And also make sure the selection is on the Calendar Control itself

  4. Once you save and publish the changes, let’s see how the control looks like.

Viewing Data in Calendar Control

Now that all the customization are published, here’s what the Calendar Control will look like –

  1. If you refresh, you’ll see the same in Calendar Control and not the Read Only grid.

  2. Also, you can switch between Day/Week/Month view

  3. If you click on any of the records, you’ll see the details of the record.

  4. And this will open the record itself.

Switching to Read-Only View

Since the default is now set to the Calendar View, you’ll need to switch it back to Read-Only.

  1. Look for the 3 ellipses or you might just see the View As button on the ribbon already.

  2. And select Read Only.

  3. And you’ll see the default shown

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!

Math Functions examples in Power Automate Flow

Here are the examples of how you can use the Math Functions from Dynamic Content in a Power Automate Flow –

In this example, I’ll use the below Inputs to perform the Math Operations on and I’ll have the Math Functions perform in the Example of the functions shown below –

Min()

Minimum gives out the smallest value in the Array of numbers.

  1. Here, I’ve created an array of numbers and from this, I’m selecting the minimum value.

  2. And the result is as below –


Max()

Inversely as the Min() function above, the Max function will return the highest number from the Array or Collection –

  1. Here’s how I use the Max function –

  2. And the result of the Max function is as below –

Add()

As it suggests, this is the addition function which will add the 2 numbers provided as arguments –

  1. In the variable, I’ll look for add and enter the 2 arguments from the Manual Trigger i.e. passing values while running the Flow.
    And as you can see below, I’m using add() function and passing the parameters separated by a comma.

  2. Then, I’m passing the below arguments when I run the Flow.

  3. And then I run the Flow, the result is as below –

Sub()

As the function suggests, you can subtract number 2 from number 1. Here’s an example –

  1. In the below Sub() function, I can see

  2. And when I pass the below arguments 20 and 5 –

  3. And the result will be 20 – 5 = 15.

Rand()

Rand() function will give out a random number from the collection at each run. Hence, the result will vary on each run –

  1. I’m providing the start number range and the end number range. And the function will select the a random number from within the range –

  2. So, when I run it for the first time, I’ll get a number

  3. And when I run it one more time, I’ll get a different number.

Mul()

Mul() function will multiple the 2 numbers passed in the arguments –

  1. I’m passing the 2 arguments within the function itself like I did for some of the above functions.

  2. And the result will be as follows –

Div()

Div function will divide the first number by the second one –

  1. In this example, I’m providing the

  2. And the result in this case is 25.

Mod()

Mod() function will give the modulo / modulus or the division happening between the dividend and the divisor i.e. you’ll get the remainder value –

  1. I’m supplying the below parameters which will give a modulus.

  2. And the result obtained is the remainder of the division –

Range()

Range() function will generate a range between –

  1. The 2 arguments required by range() function are startIndex and count. Count meaning how many numbers you want in the array.
    Notice the type of the variable has been changed to an Array now.

  2. And the result is the below Array with 6 items in the Array starting from value 2.

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!

Get Display Name of the current Flow in Power Automate

If you are working on complex Flows and need to identify which Flow a certain operation is being performed from –

Example, you are working on some Account Processing Flow you designed for Dataverse tables and there are several Flows for the Account table, but you want to start logging errors from different Flows for developer reference.

workflow() function

Here’s how you can use the workflow() function in Power Automate Flow to get the name of the current Flow –

  1. Here’s the name of the Flow which we are intending to get in the Flow run itself.


  2. In this example, I’m initializing a variable of type String to Demonstrate this

  3. Now, you have workflow() function in the Expressions area in Dynamic Content in your Flow step.

  4. Once you select the workflow() function, you can continue to type in even though you are not seeing auto-complete options. Type .tags.flowDisplayName further as shown below

  5. And click OK, make sure by hovering that the expressions is added.

  6. And when you Run the Flow to test, you can get the Name of the Flow itself.

  7. Also, you can get the other properties from the workflow() function as well. Here’s an example when you just use workflow() function and see the results –

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!

Create a GUID in a Flow | Power Automate [Quick Tip]

Here’s how you can create a GUID in a Flow!

GUID Function

Here’s how you can use the “guid()” method in Power Automate Flow to create a new GUID every time it’s run –

  1. I’m using an instant Flow to demonstrate this. And I have a variable where I’m adding a guid() method from the Dynamic Content area.


  2. Just using this, it’ll generate a unique GUID on each run.

  3. Below are some examples which were generated on each run.

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!

Schedule maintenance updates should occur for Dynamics 365 CRM environment | Power Platform Admin Center

In case you are seeing issues lately that you are not able to access your Dynamics 365 CRM or it’s running relatively slow, it might be perhaps because the platform is being updates from Microsoft’s end for importing solutions in your environment as platform updates.

System freeze could happen if any solutions are being imported into your environment. Now, you can control when the updates should be allowed so that you don’t get downtime during your business hours. Let’s look at this!


Maintenance Window Settings in Power Platform Admin Center

Given that you are already aware on how you can go to Power Platform Admin Center (https://admin.powerplatform.microsoft.com/) –

  1. Navigate to Environments, select the Environment which you want to check the Apps Updates schedule and click on Settings.

  2. Once in Settings of the Environment, you’ll see the Updates section which you can expand and you’ll see the Maintenance Window Settings – So remember, this is still in Preview as of yet and might not work as expected unless it’s in GA.

  3. And this will let you set the time frame based on when you want to Updates to be applied to the environment.
    It’ll show that it’s currently set to 02:00 to 11:00 UTC – which is not favorable for my based on my working hours since I’m in India.

  4. So, I’ll check on a service like https://www.worldtimebuddy.com/ and make sure I compare and see when is the best way to schedule my updates for –
    Currently, the above updates are scheduled for 07 am IST which won’t suit my needs.

  5. So, I’ll change it to some other time! So, something like 15:00 UTC works for my which skips my usual business hours so that my business hours are not interrupted with Updates on the platform.

    So, I select the new time and click Save. I can expect about 48 hours for this to come into effect even though updates are usually pushed over the weekends and not weekdays.
  6. You can read this Microsoft Docs on Maintenance Window Settings here – https://learn.microsoft.com/en-gb/power-platform/admin/manage-maintenance-window?WT.mc_id=DX-MVP-5003911

Check Solutions History

In order to check if your CRM environment is not working as expected, as an Administrator you can always to Power Apps (https://make.powerapps.com/) –

  1. Make sure the correct environment is selected, then

  2. Then, in Solutions, you can see History tab which will show the recent App Updates applied.


  3. And as you see above, the updates were taking place based on what my old settings were set. Hence, I needed to change the same to ensure my business hours are not affected.

Hope this was useful and this helped in clarifying the concept!

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

  1. See Trigger Outputs using Edit Columns in Flow Runs | Power Automate [Quick Tip]
  2. Adding Image field on the form in Dynamics 365 CRM | Power Platform Modern Form Designer [Quick Tip]
  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!

Create Custom APIs in Dynamics 365 CRM | Power Platform

Custom APIs in Dataverse is a great way to build your own API messages to encompass complex business operations into a single API. And Power Platform Admin Center provides a great way to keep things simple and yet build your custom APIs just like writing Plugins in Dynamics 365 CRM itself.

Pre Requisites

In order to build your own APIs, you must know the following –

  1. Writing Plugins in Dynamics 365 CRM – In case you are new to plugin development itself, you can follow this blog series wherein I’ve demonstrated how you can start writing your own C# Plugins for Dynamics 365 CRM.
    Link: Plugins Development in Dynamics 365 CRM for Beginners | [Blog Series]
  2. You’ll also need to know how to connect Postman to your Dynamics 365 CRM environment in order to test your APIs before you can use it in your custom application. I have a blog for the same as well.
    Link: Setup Postman to connect to Dynamics 365 CRM using OAuth 2.0 | Azure App Registration

Scenario

Here’s a scenario where I’ll demonstrate how you can use Custom API to do an operation in Dynamics 365 CRM and send back result to the calling application.

  1. Custom API is exposed to the calling application. Postman in this case.
  2. Once API is called and parameters is passed, a simple update of a field to an Account will take place.
  3. Result will be returned to the calling application. Again, Postman in this case.

Create your Custom API & Parameters in Power Platform Admin Center

Let’s create a Custom API that’ll pass on parameters to a plugin and plugin in-turn will send back the result itself –

  1. Assuming you have created a Solution in the correct Dynamics 365 / Dataverse environment. Click on New, and look for Custom API.

  2. Give it a suitable Name and fill in the Attributes which are required. Here, the unique name of the API is cf_processaccountapi.
    I will cover the other properties in a different blog post.

  3. Now, I’ll create 2 attributes which I need to pass as parameters to the API call itself.
    Hence, I’ll now create 2 new API Request Parameters in the solution by following the below menu.

  4. First will be the Account Code. I’ll select the Process Account API from the Custom API lookup on the form and then give unique name.
    Here, my parameter is of type String.

  5. And once I save this, this is how my parameter 1 i.e. Account Code is supposed to look.

  6. Similarly, my second parameter is as follows which accepts a String value. This parameter is called Grade Code. Again, this is just an example. Your scenario could be anything.

  7. Finally, I’ll also create a Response Property for the Custom API in order to send back the response to the caller.

  8. And just like how I defined the Request Parameters, I’ll also create the Response property as below.
    The form is quite self-explanatory by now.


  9. Once all of this is done, here’s how my API structure looks like in the solution.

Sample Plugin for Custom API & Registering it using Plugin Registration Tool

Given that you know how to work with Plugins in Dynamics 365 CRM, here’s how you can register the plugin as usual –

  1. In my plugin, I’m capturing the values from the attributes just like I would identify the context of a Plugin which runs on Update of an Account.

  2. Then, I’m finding the Account using the Account Code that was passed and updating that Account with the Option Set value which will be the Grade Code.

  3. Then, once all the processes are done, I’m setting the Output Parameter accountProcessResult with the success message.


  4. Open the Plugin Registration Tool and log into your environment. Then, Register the Assembly itself.

  5. Once your plugin has been registered, you’ll need to open the Custom API record again and associate this registered plugin on the Custom API record.
    Open the Custom API record which we created above –

  6. When you associate the Plugin Type, make sure you Save and Publish the customization.
  7. Now, we will test using Postman. Before we test, notice the Account Grade column which is of type OptionSet – we will update this using the Custom API we built.


    The OptionSet fields looks like below –

Testing Using Postman

Now that the code for the Custom API is ready as well as the Plugin too has been registered, let’s test the same using Postman –

  1. Again, in case you haven’t set the Postman to authenticate and connect to your D365 CRM environment, you can follow this post and set up your Postman to be able to call Dynamics 365 CRM.
    Link: Setup Postman to connect to Dynamics 365 CRM using OAuth 2.0 | Azure App Registration
  2. Now, given that you were able to successfully connect Postman to Dynamics 365, you can do a simple metadata call and check if you connection was successful.

  3. Now, look at the unique name of the Custom API we created.
    Now, switch the method to Post, and append the name of the Custom API itself.
    Then, in raw – select JSON type data and construct the JSON to be sent.

  4. And the result will be returned based on what Output Parameters was set.

  5. And you’ll see the data on the OptionSet being updated through this example.

Hope this was useful and this helped in clarifying the concept!

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

  1. See Trigger Outputs using Edit Columns in Flow Runs | Power Automate [Quick Tip]
  2. Adding Image field on the form in Dynamics 365 CRM | Power Platform Modern Form Designer [Quick Tip]
  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!