Setting up Codex with Power Platform MCP Server

Amongst available AI clients available, Codex is well-known by ChatGPT and here’s how you can use to configure with Power Platform MCP Server.

Install Codex on VS Code

One of the first things to do is to install Codex as an extension in Visual Studio Code –

  1. Look for the below extension and you should see a ChatGPT icon.

  2. Once this is installed, go to Extensions and you can sign in with your GitHub Pro account.

  3. It’ll open up a Sign-in page and you’ll need to enter your credentials.

  4. Make sure you open a Folder in VS Code and also ensure npm is installed by running this command in terminal ‘npm -v‘.


  5. Next, before you configure the TOML file – make sure you are having powerplatform-mcp installed locally and then configure the TOML file for Codex.

Downloading Power Platform MCP locally and connecting to the MCP

Now that Codex is installed and NPM is installed as well. Let’s first download Power Platform MCP first and then connect it to the Power Platform MCP environment –

  1. Let’s check if PowerPlatform-MCP is already installed or not by checking its version number.
    Below, it says that it didn’t find zsh, means powerplatform-mcp is not installed locally.

  2. Because I use a Mac, I can do so using Homebrew. You can check alternatively on doing this using Windows and downloading using Powershell.
    In case you face permission issues on the device, you can just run the below command –
    sudo npm install -g powerplatform-mcp” and you should see the packages getting downloaded successfully.

  3. Now, go ahead and configure the Toml file.

  4. Then, in the TOML file, you can enter the configuration like so –

  5. And when you try to query in Codex, you’ll see the results come through in the form of answers.

Hope this was useful!

Thank you!

Catalog in Power Platform

Catalogs in Power Platform are a way to distribute managed/unmanaged customization which ready install and extend on other environments. At the time of writing this post, the feature is in Preview.

Get Catalog Manager

Here’s how you can install Catalog Manager from App Source and onto your target environment –

  1. Go to the URL – https://appsource.microsoft.com/en-us/product/dynamics-365/powerappssvc.catalogmanager-preview?flightCodes=dde212e5c66047c59bf2b346c419cef6
    It’ll open in App Source as it’s not directly available from Install Apps in Power Platform Dataverse environments.
    You’ll see this App Source page –

  2. Once you click on Get it now, you’ll need to sign in using the Dynamics 365 Administrator privileges.

  3. Once you sign in successfully, you’ll need to click on Get it now again as shown below.

  4. Then, you’ll be taken to the page shown below where you’ll need to select the environment you want to install the Catalog Manager on. This will be the environment from where you’ll create your Catalog to be available to other environments.

  5. Once you confirm as shown below, Installation process will start like any other Dynamics 365 App.


    And then let it install for a few moments –


    And it’ll complete its installation in about 10 minutes.


  6. Now, once this is installed, check for the security roles available for users to be assigned with.

    Assign these roles to the Users who need to be either of them – below are the details on what the roles do.

Working with Catalog Manager

Now that Catalog Manager is installed, here’s how you can work through it –

  1. In your Apps, you should be able to see the Catalog Manager as well.

  2. Play the App, and in the App, you’ll see the Catalog Publishers table. This is where you have to create a Publisher and add Users from the Publisher for different roles.


  3. Here’s the sample Publisher I created and added the Admin User as a Publisher user as well.

  4. Once this is done, you are all set. Let’s move to the next section.

Create Catalog

Now, let’s look at the process of creating Catalogs which other environments in your Org can browse through and use –

  1. Let’s say you have a Solution which is supposedly a Catalog candidate which others can borrow and install.
    It has a mix of components which are categorized as usable in a Catalog.


  2. Here, you can select the Solution itself and click on Publish to Catalog (Preview) using the button as shown –

  3. Once you click on the Catalog, a dialog will open which you can select as Default

  4. Once you select the Default Catalog Name, you’ll be able to select if the components should be Managed components or unmanaged (as Templates).
    Then, I can choose to not select anything as a Primary Component to keep it simple.

  5. Now, I’ll enter the details as shown below which are self-explanatory.
    Published/Active Publisher will appear from the list and I can fill in the rest of the details which are applicable.

  6. Now, when I click Next, I can enter what the picture/icon should be –

  7. Finally, this is the summary and I can click Submit once done.

  8. Once everything looks good, this will be completed and show success.

  9. Now, since the Catalog is already set to auto-approval, it’ll appear in Catalogs –


Installing from Catalog

Now, as the Catalog is ready to be published, other environments can go in Catalogs and Get it from there in their current environments –

  1. For example, in this environment – I can see it in Catalogs and choose to Get it.

  2. Click Get to start installing.

  3. It’ll start installing.

  4. Once done, you’ll see that it has finished installing.

  5. And when you see the Solutions, since this was a Managed catalog – it’ll get installed as a Managed Solution in the selected environment.

  6. And the Components inside it will be managed too as expected.

Install History

As other Admins/Makers install from Catalog, you’ll see the Install History of the Catalogs in the Catalog Manager App –

  1. Under Install History, you’ll see the details as below –

Here’s Microsoft Documentation on the same – https://learn.microsoft.com/en-us/power-apps/maker/data-platform/catalog-overview?WT.mc_id=DX-MVP-5003911

Hope this was useful!

Thank you!

Create a Custom Connector For Power Automate & Power Apps

One of the most important qualities of extending capabilities of any platform is being able to add Custom code and make it available to wider use cases.

In this case, it’s a custom code that is encompassed in a Custom Connector in Power Platform and made available to Power Automate or Power Platform.

Use Case

The purpose of my custom connector is to call my hosted custom code in Power Automate or Power Apps.

For this example, I’ve created a simple Azure Function that just returns a value – just to test the working of the Custom Connector. Of course, your use case is to be able to connect to the hosted app, expect it to process the business logic which you intend to do and return back the results.
So, in my case – my Azure Function will simply greet the name passed to it.


See the Postman test below –

Now, let’s make a Custom Connector that will execute this Azure Function in your Power Automate.

Create Custom Connector in Power Apps / Power Automate

You can either make the Custom Connector from the Power Automate portal or the Power Apps Maker portal, both are the same things. Let’s see this example from Power Apps portal –

  1. In this use case, I’m in a Solution in Power Apps / Power Automate. Open the one in your case since you can’t create a Custom Connector from outside a Solution any longer.

  2. Now you can drop down from New and see in Automation menu that you can create a Custom Connector

  3. Now, you’ll be required to enter the name of the Connector itself and other details like a PNG icon for it, Description etc.

  4. Now, below is the info that I filled in. I’m calling it Data Transporter and have selected an Icon which should make me easy to recognize my connector in Power Automate and Power Apps and enter enter the details of my hosted Azure Function which is authenticated using an API Key.
    So, here’s what my info looks like –

  5. Now, when I click on Security after filling all the info, the type of Authentication I used in this case if API Key, yours could be different depending on what your custom application is configured to work with –

  6. It’ll ask you to fill in the information so that it appears as parameters to fill in for the Custom Connector when the end user will work on their Flows/Apps.

  7. The info I’m choosing to fill is this – I’m giving a name to the parameter to indicate what info is required. The actual parameter name required by the Azure Function, in this case – it’s ‘code’ and since I need to pass the API key in Query string, I’ve selected Query instead of Header.

  8. When you go to the next part, i.e. Definition, make sure you also give a Name to the Custom Connector already. Before your lose the info you’ve already entered. Make sure you also click on Create Connector


    Once you click on Create connector, it’ll create it in a few moments.

  9. Now, since you are aware of Triggers and Actions from using Power Automate – in this use case, my Custom Connector is designed to be an Action i.e. when called/used in Power Automate, it’ll simply perform the operation it’s designed to do.
    Hence, I’m selecting an Action here.
    When I select New Action from the left hand pane, it’ll open up information for me to fill out to describe the Action.

  10. Now, since this will appear as a listed item in Actions in my Power Automate connector, I’m filling in this info (and we can check later how it appears).


    Next, I’ll click on + Import from sample as it’ll give me a place to enter a sample for the request to call my hosted Azure Function.



  11. Next, I’ll pass these values as I did in Postman to create the sample. Once done, I can click on Import.

  12. When I import, I’ll the request parameters set in the Custom Connector based on the sample I entered.

  13. Next, I’ll scroll down to ensure that all validations are perfect and I needn’t fix anything.

  14. Next, I’ll skip AI Plugins step and also the Code step since I want to keep this example concise and to the scope of the hosted Azure Function only.


    And this is skipped too –

  15. Now, the final step is to Test the Custom Connector. The Editor will ask you to Update connector before you can Test. Then, in order to begin testing – you’ll need to first create a Connection using New Connection button as shown below.


  16. When you click on New Connection, you’ll be taken to a new tab to enter the API key which you created as parameter in the initial setup of this Connector. See #7 above. Enter the API key you have which works for this hosted app and then click Create connection.


  17. Next, in case the Connection doesn’t appear, click Refresh button once.

  18. Once you refresh, you should see your Connection come up and selected.

  19. Now, next step is to test the Custom Connector itself. Enter the values that you wish to test for and click Test operation.

  20. You’ll see the test results based on what the hosted code is supposed to perform.
    In my case, it was easy as it just greets the name entered.


    And your Custom Connector is now ready to be used!

Consuming Custom Connector

Now, let’s see how you can use the Customer Connector in Power Automate in order to perform the operation in your Flows –

  1. Once in Power Automate, look for the Custom tab in the Action selector.

  2. Then, you can see the Action you defined in your Connector Definition steps above.

  3. Since you need to authenticate using the API key you have, the create Connection step will ask you this info and you can give the name of the Connection.

  4. Pass the value you want to pass as data.

  5. Finally, you can just save and test the Flow itself and look for your Outputs.


    And that’s how you can have a Custom Connector for your custom app/service your have created. I’ll soon write about other aspects of Custom Connector which I wasn’t able to cover in this blog.

Hope this was useful!

Thank you!

Why Environment Variables don’t appear in Flows? | [Quick Tip]

At times, if you are new to working with Environment Variables and you’re looking to use them in your Flows but don’t see them?

Here’s why!

Flows Outside Solutions

If you are creating Flows from the My Flows section, let’s see if you can access Environment Variables or not –

  1. If you use My Flows way to create your Flows as shown below –

  2. You won’t be able to access Environment Variables in that Flow

Flows in Solutions [Default and other Solutions]

So, you’ll need to have your Flows inside a Solution – even if you are creating a Flow in Default Solution, you’ll be able to access Environment Variables from another solution –

  1. If you are in a Default Solution as shown below and you create a Flow there, you’ll be able to access Environment Variables.


  2. And you create a Flow there, you’ll be able to access Environment Variables.

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!

Power Automate Cloud Flows designer using Copilot | Now in GA

As Microsoft rolled out using Power Automate Cloud Flows designer using Copilot on 8th Nov 2023, here’s a look at how you can use it in your scenarios while designing Cloud Flows!

Copilot in Power Automate

As you might have noticed by now (based on the currently supported region you are in), Copilot is enabled in Power Automate Flow Designer directly!

  1. You’ll notice that the Designer’s look and feel is new and refined than the previous UI. Of course, I’ll need time to get familiar with this in coming days. 😊
    But I’ll share with you what I learnt so far.

  2. Next, when you click on the Step, the Properties are on a left hand side pane so you don’t see a menu dropping down in your screen as before which needed you to scroll that used to make your Action go above the screen from the top

  3. Once the Property pane appears, you can select the different types of Triggers available from the Runtime menu which was previously a Tab within the Action selection dialog box.

  4. On the right hand side, you can see the Copilot button to show and hide the Copilot pane where you can type in your Commands.

  5. Example, I can type in a query in natural language to retrieve records from Dataverse, for example. Here’s how it looks.
    My request is then turned into an appropriate trigger retrieving the correct information I was looking for.

  6. And if I check what was retrieved, I can click on this trigger to reveal the Properties and verify/change if I need to.

  7. In case there’s something that isn’t clear to understand. You won’t be returned with any action taken on the Flow itself – probably you

  8. Then, you can simply click on the thumbs down icon and submit your feedback.

  9. I faced an issue while submitting Feedback but I think I might be missing something or this is being fixed still.


  10. Further, here’s how the Add an action works – it simply reveals the pane on the right hand side which was previously a flyout menu.


Overall, the visual improvement helps in identifying with the structural flow of logic better and I’m looking forward for more updates on this is coming days/weeks and months!


For now, you can always go back to the classic designer by clicking on the ellipses and then selecting



Here’s a link to the Microsoft post on the announcement of this feature – https://learn.microsoft.com/en-gb/power-platform/release-plan/2023wave2/power-automate/use-power-automate-cloud-flows-designer-copilot?WT.mc_id=DX-MVP-5003911

Hope this helps!

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!

Migrate Flow to latest Microsoft Dataverse connector

If you are using the legacy Dataverse connector which has the gray logo and looks like the below.

You can run Flow checker to identify if Power Automate can help you migrate the Flow to utilize the latest connector.

Flow checker message

Here’s what the old Flow looks like –

  1. You would see the below message once Flow Checker suggests you changes –

  2. Once you click on the “Open the migration assistant” link on the suggestion, it’ll pop-up a window to ask if you are ready to allow Migrating the Flow to the latest Dataverse connector.

  3. Once you click on Migrate, it’ll start the migration process and based on how lengthy your flow is – in a few moments your new Flow will be ready.

  4. So, once the migration is completed, you’ll see a message like this.

  5. Once you click on Open the new flow, you’ll notice that the new Flow now has (Migrated) written in.

  6. And once you click on Edit, you’ll see that the Flow step where old Dataverse connector was used has been replaced by the new Connector

Hope this helps!

Tracked Properties in Power Automate Flow Step

If you are new to Power Automate and are wondering how Tracked Properties are and how they work?

Tracked Properties are data properties which are hidden away from the Input/Output sections of the Flow and which you can explicitly retrieve in a Flow Run.

Here’s a post to explain the same!

Tracked Properties

Below are what Tracked Properties are –

  1. If you look at the Settings section of different Actions, you’ll see Tracked Properties.

  2. And you’ll see Tracked Properties at the bottom once all Action specific Settings are listed.

  3. Here, you can create and store your own properties and it’s value. It’s value could also be results of preceding steps or from expressions.
    See example below –

  4. Once you create these Properties, here’s how you can retrieve the same.

Retrieving Tracked Properties

Here’s how you can retrieve Tracked Properties –

  1. You need to address using actions() method in Power Automate to read Tracked Properties of a certain step.
    Hence, the syntax is “action('<stepname>')?['TrackedProperties']

  2. You can store it in an Object variable and see the result as below

  3. Or, if you want to retrieve only a specific property, you can mention the same in the expressions itself.


  4. And it’ll show up like this (In anything stores Integer / String)

Hope this helps!

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

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

Thank you!