Cards in Power Apps

Cards in Power Apps can get you to send Adaptive Cards in Teams chats or channels without having to leave Power Platform to make your card!

Yes, till recently I was having a hard time to make an Adaptive Card in the Adaptive Cards Designer which is outside of the context of Dynamics/Dataverse and then embed it into Flow to be sent to a User – until Cards in Power Apps came along!

Let’s see how we can get started with the same and create our first Card and send in a Teams Chat!

Create a Card in Power Apps Maker Portal

Given you have appropriate access to create and view Cards, here’s how you can create your Card in Power Apps Maker portal –

  1. Navigate to Power Apps Maker Portal (https://make.powerapps.com/) and select the right environment with Dataverse in which you want to create your Cards.

  2. When you click on + New Card, Cards will ask you to name it and add a description.

  3. And once you create – you’ll be taken to the Card Studio.

  4. One the left hand side, you can see the menu which you can identify what the Card can be configured to do.

  5. To keep the function of the Card example, simple – I’m only displaying the logged in user name on click of a button.


  6. Notice that on the right hand side, you have different ways to deploy this Card – like in a Teams Chat.

  7. When in Play Mode, you’ll get to use the Card as it would work when deployed (or sent to a User, in this case), notice on the right hand side, you get a way to deploy the Card whether in a Chat as a link or through a Flow.

    In this example, I’ll choose a Flow.

  8. Now, it’ll initialize a Flow template with necessary steps.

  9. When ready, it’ll give this template for me to complete the Flow.


    Now, in the next section, let’s continue to finish the Flow and send it to an actual user. (Myself 😊)

Sending a Power Apps Card to Teams Chat

Now, let’s work on our Flow to be ready to run –

  1. First step is to Initialize the Card itself with an instance of the Card. Here, we’ll select the Card we just created.

  2. In the second step, you can actually choose who should the Card go out as.

  3. Then, it as ask what should should it post into. I’ve selected Chat with Power Apps since I wanted it to as a personal chat.

  4. Finally, it also needs a recipient – I’ve selected myself here to test it out.

  5. Now, when I run the Flow, I receive a chat message from Power Apps like below –

  6. And it then runs the Card itself! When I click the button as configured, it’ll read the user and display the name.



    Here’s the result!

Hope this was useful!

Thank you!

Recycle Bin in Dynamics 365 CRM | [Preview]

Now, you can retrieve deleted records up to 30 days in Dynamics 365 CRM /. CE apps.
Here’s how you turn this feature on!

Enable Recycle Bin

Here’s how you can enable this given you have the correct Dynamics 365 System Administrator privileges –

  1. Go to the Environment’s Settings in Power Platform Admin Center (https://admin.powerplatform.microsoft.com/)

  2. Now, expand Product section and go to the Features option.

  3. When you scroll to the bottom, you’ll see Recycle Bin option as a feature. At the time of this blog post, the feature is in Preview – Hence, this is not recommended for production purposes yet.
    By default, it’s turned Off.

  4. Once you flick the switch, you’ll be asked for number of days the data has to be retained for. I’ll enter 30 here and then scroll to the bottom and save the setting.

  5. Once saved, you can go to your environment and test this on a sample record. See the section next.

Deleted Records

Now, since this is enabled and post that when you delete records, here’s how you can find them for the number of days you’ve configured Recycle Bin for –

  1. For example, this is the Account record you want to delete.

  2. Go to the View Deleted Records section in the in your environment’s Settings area.

  3. You’ll see the Deleted records which you can select and choose to Restore.


  4. Confirm.

  5. Upon Restoring, they’ll appear where they were originally supposed to exist.


    Because this feature is still in Preview, here’s Microsoft’s Documentation on the same with listing of some known issues as well – https://learn.microsoft.com/en-gb/power-platform/admin/restore-deleted-table-records?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!

HTTP Trigger Azure Function Authorization Types simplified

Now, many of you must be wondering how the Authorization types for Azure Functions using HTTP Triggers work and where to look for information while using these different types. Hopefully, this post helps simplify each of those for you.

Now, when you create a new Azure Function from Visual Studio or from the Azure Portal, you’ll be asked about Authorization where you’ll find the selection to either be 1 of the below –

  1. Anonymous
  2. Function
  3. Admin
  4. System

Anonymous

This type of Authotization let’s you use the Azure Function without needing for any key and anyone with the URL alone can access it. Of course, this is not recommended for any production use –

  1. Now, if you notice your Visual Studio, when you write your first Azure Function, it comes with pre-defined method ready for you to continue to write your own code. But right away, you’ll see that the Authorization method is pre-defined considering you must’ve selected Anonymous while starting the Project.

  2. Also, since the Azure Function is understood to be Published already on the Azure Portal, you’ll see in the Function’s settings that the same has been reflected as well.

  3. Now, if you test this using Postman, the code will be able to run directly just using the URL without any API key. Either you pass in the body – and you’ll get a 200 OK with the result that the Azure Function is supposed to result.


    Or using query parameters – the result will be the same.


    This simply explains Anonymous authorization. Without any check on who’s supposed to access the Azure Function.

Function

In this type of Authentication, only the Function and resources associated to it will be accessible. This needs the caller to have a key [or code] to be passed while calling Azure Function –

  1. Let’s look at the code, and see that the type is not set to Function for Authorization.

  2. And when you Publish the code, the same will be reflected in the Settings too.


  3. And when you want to access the Azure Function from Postman, you’ll need the Function Keys defined in the Function Keys area of the Function itself – a Default Key is given already but you can choose to add your own keys and using any of them would do.

  4. Now, here’s what the Key looks like when you click on Show [there’s a button on the far right to expose the key’s value]

  5. Now, when you go to Postman, you need to can pass this as a query parameter –


    Now, let’s look at the Admin Type of Authorization.

Admin

In this type of Authorization, you get access to Functions’ Runtime APIs. The way to use the Admin key is similar to the Function Keys, just that they are available from the Function App itself than the Function –

  1. Now, when the Authorization is set to Admin

  2. You’ll see this reflected in the portal once Published.

  3. Now, in the Function App itself – you can navigate to the App keys under Functions [as of the portal’s layout in mid-2024]

  4. You can expose to see this value and share it to the clients who are going to consume this Function App. They key required here is the _master

  5. Now, you can test this using Postman


    Remember, this type of Authorization is to be used when the calling client needs to also access Functions Runtime API.
    Finally, Let’s look at the System type.

System

This type of key is managed by Function runtime and is used when the calling client when there’s a need for granular access to function runtime features.

  1. Now, you can set this from the code and publish it.


  2. And it’ll appear in the settings of the Function [In case when the Function wants to access granular function runtime features].

  3. And this is present in the App keys area under System Keys section.

  4. And when you test the same, they work just like any other key from the Function app when called.

Hope this was useful!

Lock fields on Editable Grid using JavaScript in Dynamics 365 CRM

At times, you use Editable Grid and by default – all the fields which are editable by the system are exposed and can be edited if they are present on the Editable Sub-grid. You might not want to allow all fields to be editable on the Editable Grid – so here’s how you can lock selected fields on the Editable Grid using JavaScript.

Use Case

Let’s look at the below example where by default, the fields are Editable because you are using an Editable Grid –

  1. You might want to lock the Status field since it shouldn’t be something end user should be able to change by themselves.


  2. So in such scenarios, you might want to keep most fields open but lock some of them on the Editable Grid itself. Let’s see how we can do it using JavaScript

JavaScript Code

Here’s a sample code which you can use to loop through all the fields you want to lock on the Editable Grid –

  1. Code within a class – [You can just use the lockFields function separately too.]

    oSubscriptionCustomization = {

    lockFields: function (executionContext) {
    var oFormContext = executionContext.getFormContext();
    if (oFormContext) {
    var arrFields = ["cft301_status"];
    var objEntity = oFormContext.data.entity;
    objEntity.attributes.forEach(function (attribute, i) {
    if (arrFields.indexOf(attribute.getName()) > -1) {
    let attributeToDisable = attribute.controls.get(0);
    attributeToDisable.setDisabled(true);
    }
    })
    }
    }
    };

  2. In the above code, I’m reading from an array called arrFields and all the fields listed in the array will be looped through and locked.
  3. Once my JS file is ready, I can open the Editable Grid control itself on the parent form and then loop for Events tab to register my function on the grid.

  4. In the Event tab, look for the UI Event called as OnRecordSelect

  5. Here, you can register your function. Since, I’m using class too – I’ll use classname.functionName

  6. Once done, save and publish your changes. Now, you’ll see that the field is locked when you select the record on the Editable Grid.

Hope this was useful!

Thank you!

Update SVG Icon to Custom Entity in Sitemap | Model Driven Apps

So, if you are used to updating Icons to entities in the classic UI, here’s what you need to do in order to update the SVG image of a Custom Entity you just created using new Power Apps Maker portal.

Let’s see below is you custom entity and it comes with its default icon which you want to set to a custom SVG icon.

Adding SVG Icon to Custom Entity

Given that you have appropriate access to the be able to Customize the system, follow the below steps –

  1. In your solution, you have the table as well as the SVG Icon you just created the Web Resource for and uploaded an image which you want to set as Icon.

  2. Now, select the Table you want to set the SVG icon to, and click on Properties.

  3. On the right hand pane, expand the Advanced area and look for the Choose table image field.


  4. Then, start typing the Display Name of the SVG icon which you wish to set to this Entity.


    Click Save if no other changes are to be done.

  5. Once Saved, click on Publish.

  6. Now, when you refresh the App where the custom entity is listed in the Sitemap, you’ll see the icon updated.

Hope this was useful!

Thank you!

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!

Use Monitor to debug Model-driven apps remotely | Power Platform

Monitor is one feature that comes in super handy when end-users complain about an issue which is difficult to ask end users to send across logs from the browser.

And here’s where Monitor comes in handy!
Let’s see how this works through this simple blog post!!

Capture events from Monitor in Model Driven Apps

Here’s how you can Monitor in Model-driven apps’ Monitor to capture issues on an End User

  1. You can go to Power Apps Maker Portal (https://make.powerapps.com/) and make sure you are switched to the intended environment.
  2. Then, select Apps on the left hand pane and expose all the Apps. Select the Model-Driven app you want to enable Monitor for. Once you select, you can then drop down from Details flyout menu and click on Monitor.

  3. Once you click on Monitor, it opens the Monitor application itself where all the logs you work on will be captured. And you can also notice that there’s a Play model-driven app button as well to enter in Debug mode.


  4. It opens the Model-driven app in a new tab and asks you to confirm if you want to join the debug session.

  5. Once you click on Join, it’ll run the app in debug mode and you can see the Monitor tab and notice that it has started capturing the logs based on your operations in the Model-driven app session you are running in parallel.


  6. And when you go about working in the model-driven app, it’ll keep capturing the traffic just like on a browser’s Network in Dev Tools

  7. Now I deliberately added an erroneous code in my custom JS so that I could capture an exception in the monitor.

  8. And if you look at the monitor, you’ll see that this has been captured.

  9. And this is the wrong script I entered so that my code wouldn’t find the incorrect field name and throw an error when I try to retrieve value from an attribute that doesn’t exist (without null checking if the attribute exists or not)

  10. However, best use case is when you ask end-users to join your session. Let’s see in the next session on how you can achieve this.

Invite Users to your Debug session

In the Model-driven apps monitor, here’s how you can invite other users to join your session –

  1. In the Monitor, you’ll see Invite or Connect to a User. For this example, I’ll choose Connect user option.

  2. Then, I can simply search for the User whom I want to generate a join link for.

  3. Now, once this user is added, you’ll see a copy link option to copy the link and pass it on to the user who needs to join.

  4. Once the end user has this link, then can join the session and they’ll see this message on their Dynamics model-driven app

  5. And similarly, once they start reproducing the issue, you can start capturing the traffic on your end.


Hope this was useful! In order to fully understand the capabilities of Monitor for model-driven apps, here’s Microsoft’s official documentation – https://learn.microsoft.com/en-us/power-apps/maker/monitor-collaborative-debugging?WT.mc_id=DX-MVP-5003911

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!

Pre-Export Step Required setting in Deployment Pipeline | Power Platform Pipelines

Now that you must’ve already setup your basic Power Platform Pipeline as yet and are looking to explore how to extend the Power Platform Pipeline to do more advanced operations, this post is for you!
In case you are still looking to first setup your Power Platform Pipeline, you can check this Blog Series which this very post too, is a part of – Power Platform Pipelines | Blog Series

What is Pre-Export Step Required Setting?

This is the ability to have a trigger before an Export operation from the Development Environment is initiated in order to run the pipeline – only available for the first stage in the pipeline.

This is provided so that you may want to run some external operations before this is taken through the pipeline for deployment.

Use Case is – that you want to first seek an approval from the Admin before the Solution is deployed to Production (or rather, sent through the pipeline for deployment). Once approved, the pipeline should automatically proceed towards executing the rest of the deployment stages.

Pre-Export Step Required

While setting up your Pipeline, in case you were wondering what Pre-Export Step Required setting was, see below –

  1. Once you mark this field as checked/Required, save the record and it’ll appear like this on the record.

  2. What this does is, it runs the trigger action ‘OnDeploymentRequested’

  3. And once this Flow is trigger based on this Action, you can perform custom logic to be carried out and be successful before the deployment is carried forward.
    In this example, I’m setting a simple Approval process to be in place so that the Admin is aware and approves all the Deployment requests.

  4. Now, once an Approval is received, you need to check the status of the request and if it’s Approved, you need to run Perform an unbound action to initiate the Action ‘UpdatePreExportStepStatus
    You’ll need to pass the StageRunId – You’ll get this in the Dynamics Content Properties of the Flow itself from the trigger.
    Then, you need to set the Status of 20 – this means Approved.
    For rejection, the status to set is 30.

  5. Now, once this Flow is in place, every time a Pipeline is Run to deploy the solution, it’ll first wait for the Approval process to complete and the pipeline itself will show the below message.

  6. This status can also be seen in the Deployment Stages in the ‘Deployment Pipeline Configuration‘ app as well.

  7. Now, the Admin on the other hand, will receive a Power Automate Approval like this (based on whatever you have configured). This is received on both Approvals in Teams and in Power Automate as well.

  8. Once the Approver approves, I’ll enter some notes while approving.

  9. The pipeline will then proceed to deploy to production.

  10. And this will also proceed on the UI in Pipelines as well.

  11. Once deployed, you’ll see that this is completed Successfully if there are no issues.

  12. You can also see the History. The End Time will represent when it was completed as opposed to Start Time representing when the Deployment Request was initiated.

  13. And also in the ‘Deployment Pipeline Configuration‘ app.



Here’s official Microsoft documentation on how you have Gated Extensions like these to be in place in Power Platform Pipelines – https://learn.microsoft.com/en-us/power-platform/alm/extend-pipelines#gated-extensions-available?WT.mc_id=DX-MVP-5003911

Hope this was useful!

Thank you!