[Preview Feature] Model Driven Apps | Edit Command Bar

In this article lets explore the ‘Edit Command Bar’ preview feature available in Model Driven Apps designer. But first lets understand the following basics of Command Bar.

  • What are Command Bars?
  • Where do we find them in Model Driven App (i.e., Command bar locations)?

What are Command Bars?

  • Command bars are at the core of every model-driven app and appear in many different locations.
  • The group of commands associated with a specific location make up a command bar.

Command bar locations in Model Driven App:

  • Main grid. This command bar is displayed when using the left-hand navigation of an app to view a full page list of records in this table.
  • Main form. This command bar is displayed on the table’s main forms. This appears at the top of the form and is not the same as the associated view or subgrid view that will appear in different areas of the form.
  • Subgrid view. This command bar is displayed on forms of other tables that render this table’s data within a subgrid.
  • Associated view. This command bar is displayed on the form of a parent table when viewing related data in this table.
  • Quick actions. There isn’t a specialized entry point from the command designer because quick actions are edited from the main grid of the table.

Now that we got the basics, lets explore editing the Command bar.

Using ‘Edit command bar (preview)’:

  • To use ‘Edit command bar (preview)’ feature. Connect to Power Apps portal.
  • Create a new ‘Model-driven app from blank’ and select the ‘Modern app designer (preview)’.
  • Add a Page and link one of your Dataverse Table.
    • I’ve added ‘Student’ table as Page.
  • Now click on ‘…’ of ‘Student’ and click on ‘Edit command bar (preview)’.
  • From the options choose one of the ‘Command Bar’ location you would like to edit.
  • In the next screen, you will get all the available of Commands displayed as below.
    • At this point editing ‘Legacy button is not supported’. Refer the limitations here.
  • I am going to add a new ‘Command’ named ‘Open My Blog’ which opens up an URL.
  • Click on ‘+New command’ and provide details on the right pane.
  • Action property specifies what happens on the ‘Select’ of the ‘Command’. Below are 2 available options.
  • As I need to open URL on the select of my ‘Open My Blog’ command. Under Action’ choose ‘Run formula’ and in the formula bar add ‘Launch()’ Power Fx as below.
  • Click ‘Save and Publish’ and ‘Play’.
  • On your App, you should see the command and on select it redirects to the provided URL.

Refer the docs link for more details.


Categories: PowerApps Tags: ,

Dynamics 30 days trial | Changes in subscription steps

August 3, 2021 2 comments

As we know trials.dynamics.com would allow us to subscribe to Dynamics 30 days trial using our personal email (i.e., Live.com, etc…). With the recent changes, trials.dynamics.com redirecting us to the following portal.

Up on clicking ‘Try for free’ its mandating us to enter “Either Work or school email ID”.

Which means we can’t sign up using personal email. But wait, when you give the personal email and try, you get an error message and a ‘Click here’ link, which allows you to sign up using personal email.

Click on ‘Click here’ and you will be redirected to the classic ‘Sign up’ screen.

Alternately you can directly use this link to go to the above Sign up page directly by passing new portal.

Hope this info saves you sometime 🙂

[Step by Step] Postman tool with Microsoft Dataverse Web API

July 21, 2021 1 comment

Couple of years ago, I’ve blogged Postman tool using Dynamics 365 online. In this article, lets go through the steps to connect Postman tool with Dataverse Web API.

While most of the steps are unchanged, there is a simplified way now to connect to Dataverse Web API with out the need of registering App in Azure AD. Lets get started.


  • Power Apps Environment (Subscribe to 30 days trial, if you have not one).
  • Postman Desktop App. (Download here)
    • Note: These steps will not work with Postman web version.

Get Dataverse Environment URL:

  • Connect to Power Apps portal.
  • Select the ‘Environment’ you wish to connect from Postman tool.
  • Click on ‘Settings -> Advanced Settings’
  • Copy the URL up to the ‘dynamics.com/’ from the new window as shown below.
  • Add ‘.api’ before ‘.crm.dynamics.com’ to the URL.
  • Copy and Save this URL, which would be used in next steps.

Set up Postman Environment:

We would need ‘Workspace’ and ‘Environment’ to get started with Postman.

  • Open the Postman tool and create a new ‘Workspace’ if not having already.
  • Click on create a new ‘Environment’.
  • In the ‘Add Environment’ screen, we need to add Variables related to ‘Dataverse’ which helps Postman to connect Dataverse Web API.
  • Following 6 variables need to be configured.
Variable reference diagram
  • Lets add the first Variable “url“. In the ‘INITIAL VALUE’ paste the Dataverse environment url copied in previous section.
  • Repeat the step for next 5 variables and looks as below. Click ‘Add’ to save the Postman ‘Environment’.

Authorize Postman to Dataverse Environment:

Now that we have Postman Environment ready with required variables. Lets authorize and connect the Postman to Dataverse Web API. For that we need to complete ‘Authorization‘ and generate a new ‘Access Token’.

  • Select to the new Postman ‘Environment’ created in previous section.
  • Create a new GET ‘Request’ and select {{webapiurl}} variable as url.
  • Click on ‘Authorization’ tab and select ‘TYPE’ as ‘OAuth 2.0’ and click on ‘Get New Access Token’.
  • Provide details as below in the ‘Get New Access Token’ screen and click ‘Request Token’.
  • In the next screen, provide the Office 365 credentials.
  • Post successful authentication, a new ‘Access Token’ gets generated as below. Click ‘Use Token’.
  • ‘Access Token’ expires every 1 hour and you would get “401 Unauthorized’ exception upon expiry.
  • Click on ‘Get New Access Token’ if the Token expires to get a new Access Token. From 2nd time, Token generates instantly without any further sign-in.

Connect Postman to Dataverse Web API and query:

As we completed ‘Authorization’ and got the ‘Access Token’, we are good to query Dataverse API.

  • Create a new GET ‘Request’ and select {{webapiurl}} variable as url.
  • In the ‘Authorization’ tab, select the ‘Access Token’ generated and click ‘Send’.
  • You should get the Response as below with 200 Status code.
  • Below is the sample to fetch Top 3 Account records.


Canvas Apps | Optimization | Quick way to find and clean unused variables

Many a times, in Canvas Apps we would have declared variables but no longer used them. In a complex App with substantial screens, its tedious to identify and clean up the unused variables.

In this article, lets learn how to identify unused variables and clean up. If you are unversed with ‘Variables’, refer this article.

On a high level, Set() is used to define Global variable and UpdateContext() or Navigate() are used to define Context variable (i.e., Scope limited to a screen).

To understand unused variables and clean better, I’ve built a simple Canvas App using below steps.

  • Create a new Canvas App from Power Apps portal.
  • On App ‘OnStart’ event, declared 4 Global variables using Set().
  • Add a new Screen with 3 buttons. As buttons Text, used the one of the global variables(i.e.,btnLabel1) declared in App ‘OnStart’. Repeated the same for other 2 buttons.
  • To understand Context variables, on “btn1’s” OnSelect declared 2 context variables using UpdateContext().
  • Now that we got both Global and Context variables, lets understand about variables in-depth.
  • Go to File -> Variables, you will find 2 tabs ‘Global’ and ‘Screen1’ (this is for Screen1 Context variables).
  • Now click on one of the Variables, and you will find 3 tabs:
    • Definitions : Statement where this variable was declared. In our case its App ‘OnStart’.
    • Uses : Where this Variable used.
    • Indirect uses :  Any control indirectly refers the variable. Lets see this in detail in next step.

  • Click on ‘Uses‘, you will find where ‘btnLabel3’ directly referred (i.e., Text of button 3).
  • To understand ‘Indirect uses‘, lets add a new Label and set the Text as “This is indirect label of a Button : ” & btn3.Text“.
  • In the above statement, ‘Button 3’ text was ‘Directly’ set to ‘btnLabel3’ variable, here new Label’s text was set to ‘Button 3’ text, which indirectly referring ‘btnLabel3’ variable.
  • Now, click on ‘Indirect uses‘ of “btnLabel3” variable and you would see the new Label’s text statement.
  • Coming back to the crux of this article, to identify a Unused variable, click on Variable and go to ‘Uses‘ tab. If its blank, you can navigate to the declaration statement from ‘Uses‘ and remove the statement.


Categories: CRM, PowerApps Tags: ,

Power Platform | 2021 Wave 1 | Features

With 2021 Wave 1, lots of new features introduced across the Power Platform (i.e., Power BI, Power Apps, Power Automate, and Power Virtual Agents) and the two add-ins (i.e., AI Builder and Power Apps portals).

2021 Release Wave 1 Plan, contain the features releasing from April 2021 through September 2021. Features list can be downloaded from here.

In this article, lets see the few key features/enhancements included in this release.

Dependent assemblies for plug-ins:

  • Plug-in developers have long used an unsupported capability provided by the ILMerge utility to combine a plug-in assembly plus any needed dependent assemblies together into a single .NET assembly.
  • The dependent assemblies capability provides a supported way for developers to include additional dependent assemblies along with the plug-in assembly when registering a plug-in.

Plug-in telemetry with Application Insights integration:

  • Customers who have associated their Environment with their Application Insights resource can view telemetry for log events written from their plug-in code.
  • ILogger is a standard interface for writing log events.
  • ILogger interface enables writing log events for a set of log levels, such as Trace, Debug, Information, Warning, Error.
  • The developer doesn’t need to configure or include Application Insights SDK assemblies because everything is already set up.

Advanced lookup:

Multi-table lookups:

  • If you are familiar with data type Customer, which connects to both Account and Contact, its Multi-table lookup.
  • Multi-table lookup type columns allow a user to employ a specific table that has multiple one-to-many (1:M) relationships to other tables in the environment. A single lookup type column can refer to multiple other tables.
  • This new feature gives users the power to define any other multi-table lookups they may need.

Removing business units from security role assignments:

  • Business units can be removed from a user’s security role assignment for ease of use and to simplify the business unit security model.
  • By decoupling a user’s business unit from their security role’s business unit, they can be assigned security roles from different business units. This allows the user to access the respective business units without the need to create and join the owner team.

Virtual Connector Provider for tabular connectors:

  • As we know, Virtual tables (Formerly known as ‘Virtual Entity’) enable the integration of external enterprise data with Microsoft Dataverse without the need for data duplication.
  • With the introduction of the Virtual Connector Provider for Dataverse, data residing outside of Microsoft Dataverse can be easily represented and used as Microsoft Dataverse virtual tables using supported tabular connectors (for example, SQL Server, OneDrive, Excel, SharePoint, and more).

Model-driven app adds in-app notifications:

  • In-app notifications in model-driven apps are shown to users as a notification or in the notification center.
  • Notifications are directed to a specific user and can be sent through external systems, Power Automate, or from within the system.

Power Apps component framework for canvas app:

  • Public preview of Power Apps component framework allows developers and makers to add datasets and test their custom components in canvas apps, taking advantage of the growing list of supported framework APIs.
  • Pro-dev extensibility on a low-code platform opens up possibilities enabling the best of both worlds.

Link a Microsoft Dataverse environment to Azure Synapse Analytics workspace and bring Dynamics 365 data to Azure:

  • With this feature, you can use Export to Data Lake to link a Microsoft Dataverse environment to Azure Synapse Analytics workspace and bring Dynamics 365 data that’s stored in Microsoft Dataverse to Azure.
  •  It enables a seamless integration with Azure Synapse, which provides the necessary compute to analyze data in the Data Lake using features, such as SQL on-demand.
  • These features provide a familiar T-SQL syntax to query data in the Data Lake without the need to copy or load data into a specialized store.

Auditing enhancements:

The following changes have been made to Auditing:

  • Audit data is stored in log storage.
  • Administrators can set a retention period for audit data.
  • Expired data will automatically be removed from the system per the retention period.
  • Joining entities from the database storage and the log storage will no longer be possible.

Bypass Custom Business Logic:

  • Refer my previous article on this feature.


Categories: PowerApps Tags: ,

Dataverse | Bypass Custom Business Logic

There are times when you want to be able to perform data operations without having custom business logic applied. Especially during complex data migration scenarios, we would not want our custom business logic (i.e., Sync Plug-ins/Real time Workflows) to be triggered.

The manual option to disable custom logic is,

  • We have to locate and disable the custom plug-ins. But this means that the logic will be disabled for all users while those plug-ins are disabled. It also means that you have to take care to only disable the right plug-ins and remember to re-enable them when you are done.

Now using BypassCustomPluginExecution option we can disable custom business logic programmatically.

About BypassCustomPluginExecution:

When you send requests that bypass custom business logic, all synchronous plug-ins and real-time workflows are disabled except:

  • Plug-ins which are part of the core Microsoft Dataverse system or part of a solution where Microsoft is the publisher.
  • Workflows included in a solution where Microsoft is the publisher.

There are two requirements:

  • You must send the API requests using the BypassCustomPluginExecution option.
  • The user sending the requests must have the prvBypassCustomPlugins privilege. By default, only System administrator’s have this privilege
    • The prvBypassCustomPlugins is not available to be assigned in the UI at this time. We can add a privilege to a security role using the API.

Using BypassCustomPluginExecution:

  • Web API:
    • Pass MSCRM.BypassCustomPluginExecution : true as a header in the request.
POST https://yourorg.api.crm.dynamics.com/api/data/v9.1/accounts HTTP/1.1
MSCRM.BypassCustomPluginExecution: true
Authorization: Bearer [REDACTED]
Content-Type: application/json
Accept: */*

  "name":"Test Account"
  • Organization Service:
    • Set BypassPluginExecution to true at the service, it will remain set for all requests sent using the service until it is set to false.
var svc = new CrmServiceClient(conn);

svc.BypassPluginExecution = true;

var account = new Entity("account")
    Attributes = {
        { "name", "Test Account" }

  • At Request class level:
    • BypassPluginExecution parameter, which is Optional, must be applied to each request individually.
    • You cannot use this with the 7 other IOrganizationService Methods, such as Create, Update, Delete.
    • You can use this method for data operations you initiate in your plug-ins.
var svc = new CrmServiceClient(conn);

var account = new Entity("account")
    Attributes = {
        { "name", "Test Account" }

var createRequest = new CreateRequest
    Target = account

createRequest.Parameters.Add("BypassCustomPluginExecution", true);


Adding the prvBypassCustomPlugins privilege to another role:

  • Because the prvBypassCustomPlugins is not available in the UI to set for different security roles, if you need to grant this privilege to another security role you must use the API.
  • The prvBypassCustomPlugins privilege has the id 148a9eaf-d0c4-4196-9852-c3a38e35f6a1 in every organization.
  • Code Snippet:
var roleId = new Guid(<id of role>);

    new Relationship("roleprivileges_association"),
    new EntityReferenceCollection {
            new EntityReference("privilege", new Guid("148a9eaf-d0c4-4196-9852-c3a38e35f6a1"))

Refer Docs article for more details.


Power Apps | Sharing | Restrict ‘Everyone in Environment’ option using PowerShell

In Power Apps, by default Users with ‘Environment Maker’ role can create and share the Apps. One of the sharing option is ‘Everyone in Instance’, which grants access to all Users in the Azure tenant.

In one of our requirements, we had to restrict the ‘Share with everyone’ option for the ‘Environment Makers’ and limit to ‘Global Admins’. Lets see how to achieve this in this article.


In my Power Apps account, I got 2 Users.

  • Rajeev – Global Administrator.
  • Jayansh – Environment Maker.

User Jayansh, created an App named ‘Simple App’ and wants to share. By default ‘Everyone in Environment‘ option is enabled.

Lets restrict this option using the following PowerShell commands.

PowerShell script:

  • Open the PowerShell console in ‘Administrator’ mode.
  • Execute Add-PowerAppsAccount command to connect to the Power Apps tenant.
  • Execute following command, to check the current state of ‘Share with everyone’ (i.e., Everyone in Environment) option. It returned ‘False’ in my case, which means ‘Share with everyone’ option is available .
    • $settings = Get-TenantSettings
    • $settings.powerPlatform.powerApps.disableShareWithEveryone
  • Lets turn off the ‘Share with everyone’ option using following command.
    • $settings.powerPlatform.powerApps.disableShareWithEveryone=$true
    • Set-TenantSettings $settings

Try Sharing the App as ‘Environment Maker’

  • Connect to Power Apps portal as User ‘Jayansh’ who is ‘Environment Maker’.
  • Select the App and click ‘Share’. Select the ‘Everyone in MS‘ (MS is my environment name) and click ‘Share’.
  • An exception message will be thrown as below.

Try Sharing the App as ‘Global Administrator’

  • Connect to Power Apps portal as User ‘Rajeev’ who is ‘Global Administrator’.
  • Select the App and share using ‘Everyone in MS‘ option.
  • And the App gets shared successfully.


Categories: PowerApps Tags: ,

Power Apps Developer Plan

In May 2021, Power Apps Community Plan has been extended to meet the needs of developers and rebranded as the Power Apps Developer Plan.

What is a Developer Plan:

  • Power Apps Developer Plan gives us a free development environment to build and test with Power Apps, Power Automate, and Microsoft Dataverse.
  • This Developer Plan is meant for development and test use only. A paid plan is required to deploy or run solutions in a production environment for production use.

Developer plan included following changes compared to the Community plan:

  • Ability to share apps with team members for development and testing purposes.
  • Increased capability allocations.
  • Ability to create more environments to support ALM (Application Lifecycle Management) scenarios (coming soon).

Existing Power Apps Community Plan users will also get all these updates.

Developer Plan Limitations:

  • The following capacity limits apply for the individual environments.
Flow runs/month750
Database size2 GB
  • You can’t add any other user as an Environment admin or a Maker, or to the database roles from the admin center.

Sign up:

  • Signing up to Developer Plan can be done using work or school account. Signing up with a personal account is not currently supported.
  • Click here to sign up.


Canvas App | Display and Download large data sets of Images from Azure Blob Container with no delegation issues

In one of my previous articles, I detailed the steps to embed a Canvas app with upload image to Azure Blob feature.

In this article lets see, how to work with large data sets and achieve following:

  • Displaying blob images in Gallery.
  • Ability to Download the image.
  • Azure Storage Account and Container. Get free Azure subscription here
  • Dynamics 365 account. Get 30 days trail here

Set up Azure Storage Account and Container

  • Connect to your Azure portal.
  • Create a new Storage Account and capture the Storage Account ‘Name’ and ‘Access Key’.
    • I’ve named Storage Account name as ‘expmar’
  • Create a new Container and copy the Name.
    • I named my Container as ’employee’.
  • Upload few images, which will be used to display in Canvas App.

Steps to create Canvas App and Connect to Azure Blob

Create Azure Blob Storage Connection:
  • Connect to Power Apps Portal using your Dynamics 365 account.
  • To connect to Azure Storage Account from Canvas App, we need a new ‘Azure Blob Storage’ Connection.
  • Click on ‘Data -> Connections -> Azure Blob Storage’ and provide Azure Storage Account ‘Name’ and ‘Access Key’ captured in previous section and click ‘Create’.
  • Up on successful creation, you should see the ‘Azure Blob Storage’ under ‘Connections’.
Steps to Create Canvas App and display blob images
  • Create a new Canvas App.
  • Add the ‘Azure Blob Storage’ connection created in previous step to the Canvas App from ‘Data -> Add a connection’.
  • As we established connection to Azure Storage Account, next, connect to ‘Container’ (i.e., Employee) and read the images to a List.
  • Use following formula on App’s ‘On Start’ event.
  • This formula, reads the images from ’employee’ Container and store the images in ’employeePhotos’ Collection.
  • Now we have the images in ’employeePhotos’ Collection, add a Gallery control and bind to ’employeePhotos’ Collection.
  • To display images, In the Gallery, add an ‘Image’ control and in the ‘Image’ property add following formula.
  • To display image name, add a ‘Label’ control and set Text as ‘ThisItem.DisplayName’.
  • To check whether images are rendering click on ‘App -> Run OnStart’ and you should see the images upload to Azure Blob Container in the Gallery.

Steps to Build Download feature
  • To download an image from Azure Container, we would need following 2 values:
    • URL : Azure Storage Account URL.
      • URL format would be “https://{Storage Account Name}.blob.core.windows.net
      • In my case, its “https://expmar.blob.core.windows.net”
    • SasToken (Shared access signature Token):
      • Generate the ‘Shared access signature’ as below from Azure portal.
  • Set ‘URL’ to ‘bloburl’ and ‘Token’ to ‘sastoken’ variables ‘OnStart’ of the App.
  • Complete ‘OnStart’ formula looks as below.
  • Add a ‘Download’ icon to the Gallery.
  • On ‘OnSelect’, use ‘Download(bloburl & ThisItem.Path & sastoken)’ formula.

Test the App
  • Run the App and you should see Images and ‘Download’ icon as below.
  • Click on ‘Download’ icon and image should get downloaded.


Categories: PowerApps Tags: , ,

Canvas App Import Failure | CanvasAppEnvironmentMismatch error

February 9, 2021 Leave a comment

We configured a new Dynamics Instance copied from another Instance using ‘Customizations and schema only’ option.

While importing a solution with a Canvas App, the solution import failed with CanvasAppEnvironmentMismatch error

CanvasApp import: FAILURE: Code: CanvasAppEnvironmentMismatch Message: The specified app ‘xxx-xx-xxxx-xx’ belongs to the environment ‘xxx-xx-xxxx-xx’ and not ‘xxx-xx-xxxx-xx’ which is the environment associated to instance ‘xxx-xx-xxxx-xx’

Its a strange because, the Instance is a copied one and there were no Canvas Apps exist, when checked in the PowerApps Portal -> Apps tab.


  • Even though the PowerApps portal not showing up any Apps, when queried the ‘Canvasapps’ Data Verse entity using oData URL, there were Canvas App records pointing to a different Instance (i.e., The Source Instance which the current instance copied from).
    • Copy the name of the App from json collection. We would need it in next steps.
  • Solution import failed because of the matching Canvas App entry pointing to a different Instance in ‘Canvasapps’ entity.


  • Write a C# console and delete the entry in ‘Canvasapps’ entity.
  • Following is the sample code.
 var queryCanvasApps = new QueryExpression("canvasapp")
                    ColumnSet = new ColumnSet(true)

                var filter = new FilterExpression(LogicalOperator.And);
                var cond1 = new ConditionExpression("name", ConditionOperator.Equal, "{App_Name copied in above section}");

                queryCanvasApps.Criteria = filter;

                var apps = CrmService.RetrieveMultiple(queryCanvasApps);

                foreach (var app in apps.Entities)
                    //Delete the App entry
                    CrmService.Delete("canvasapp", app.Id);
  • Post deletion, reimport the solution and it should work.