Skip to content

Author: Ben

Create a Dataverse like ribbon button for a Canvas App

Posted in Power Platform, and Dynamics 365

In my private project (Key Box), I created a custom page to edit settings that are stored in an environment variable. To give it the look & feel of Dataverse, it needed a ribbon button to save the settings made. I decided against the awesome Creator Kit because I only required one single button and don’t want to have additional dependencies.

Dataverse like ribbon button

Out of the box buttons in Canvas Apps have no icon. They are text only, except you set an emoji in the text. Therefore, I decided to build my own button with a combination of an icon and a label, that are layered and covered by a transparent button.

Dataverse like ribbon button
Dataverse like ribbon button

Some attributes depend on your preferences, like the height or the position.
Following, you find the main attributes for the button that I used:

Text = ""
Width = 'ico Save'.Width + 'lbl Save'.Width
FillColor = RGBA(1; 1; 1; 0,0)
HoverFillColor = RGBA(0; 0; 0; 0,05)

How to delete a developer environment with Power Automate

Posted in Power Platform, Dynamics 365, and Power Automation

If you only understand the first and the last part of the title, you should click the button below to learn more about the “Power Apps Developer Plan” that includes a free Dataverse for developer (and for makers or course).

Normally Power Platform administrators can create, edit and delete Dataverse environments through the “Power Platform Admin Center” (https://admin.powerplatform.microsoft.com/environments), but developer environments from the “Power Apps Community Plan” differ here.

  • They can only be created through the “Power Apps Developer Plan” page at Microsoft (button above)
  • Everyone with Microsoft work or school account can create one personal development environment per tenant
  • They can not be edited (update name or URL) or deleted through the portal

How to delete a developer environment

I found out, that Nick Doelman already has perfectly described, how to delete a Power App Community Plan environment with PowerShell. Inspired by his blog post, I remembered that there is a “Power Platform for Admins” Connector for Power Automate (and Logic Apps) and I checked it out for you.

  • Open the the Maker Portal (https://make.powerapps.com) and select the default environment of your tenant on the right side of the header menu. Only there the Flow will be later reusable, because you don’t delete it with the environment it exists in.
  • Create a new instant Cloud Flow and give it a name, for example “Reset DevEnvironment”
  • Add an input parameter to the trigger action that will receive the environment ID
Dataverse like ribbon button
  • Search for the “Power Platform for Admins” connector and select it. I got the best search result by typing “PowerApp”.
the power platform for administrators connector
  • Now scroll down and select the “Delete Environment” action.
delete a developer environment with power automate
  • Select “Enter Custom Value” as environment input for the action and choose the ID that comes from the trigger action
Dataverse like ribbon button
  • Save your Flow

Usage of the flow

Dataverse like ribbon button

Now run the Flow and paste the Environment ID as parameter.

Dataverse like ribbon button

The flow run takes something between 30 and 120 seconds and ends with an 404 error, but at the end the environment has gone and you can create a new Power Apps Community Plan Environment again.

Dataverse like ribbon button

“Command Checker” bookmarklet

Posted in Dynamics 365, and Power Platform

Last week, I found out that Microsoft released a Command Checker for model-driven-app-ribbons – OVER 2 YEARS AGO! I totally missed that.
I especially love that it shows me the result of each single display rule and enable rule.

To enable the Command Checker as a button in the ribbon bar, you need to add the URL parameter “ribbondebug=true” to the current D365 CE URL and reload it. But who wants to remember ugly URL parameters…

javascript: (var _href = window.location.href; if (_href.includes("ribbondebug")){_href.replace("ribbondebug=false", "ribbondebug=true")} else {_href += "&ribbondebug=true"} window.location.href = _href)

Open these bookmarklet anywhere in model-driven-app, and it will reload the window with the activated Command Checker.

“Advanced Find” bookmarklet

Posted in Dynamics 365, and Power Platform

Since February 2022, Power Platform Admins can enable the “Modern advanced find in model driven apps“. After a decade of continuity, it is great to see a fresh, clean look and some new features in a unified user interface.

In case you are a CRM veteran like me and also miss the old advanced search, I have something for you.

javascript: (window.open(Xrm.Utility.getGlobalContext().getCurrentAppUrl() + "&pagetype=advancedfind"))

Open these bookmarklet anywhere in Dataverse, and it will open a new window with the classic advanced find in it.
Don’t forget to get used to the new advanced find.

“Get attribute by attribute ID” bookmarklet

Posted in Dynamics 365

Background information

Currently, I have a problem while applying a solution upgrade for our managed solution. The message in the solution history gives me the name of the attribute that blocks the uninstallation and its ID, but it did not tell me to which entity the attribute belongs.

Get attribute by attribute ID

To identify the right entity for the attribute professionally and not by trail and error, I looked into the “Query table definitions using the Web API” article on Microsoft Docs and build a browser bookmarklet for an easier use.

The “Get attribute by attribute ID” bookmarket

Copy and paste the following code as URL of a bookmark in your browser and execute it on any D365 page.

javascript:function getDet(){var r=JSON.parse(this.responseText);console.info("MetaData for Entity: " + r.LogicalName);console.dir(r);console.info("MetaData for Attribute: " + r.Attributes[0].LogicalName);console.dir(r.Attributes[0])};function getAtt(){var r=JSON.parse(this.responseText).value,etn,atn;for (let i=0; i < r.length; i++) {if (r[i].Attributes.length > 0) {Xrm.Navigation.openAlertDialog({confirmButtonLabel:"Close",text:"Entity: "+r[i].LogicalName+"\nAttribute: "+r[i].Attributes[0].LogicalName+"\n-\nOpen Browser Console for more MetaData Details (F12)",title:"Found Attribute"},{height:250,width:350});var oReq=new XMLHttpRequest();oReq.addEventListener("load", getDet);oReq.open("GET","/api/data/v9.0/EntityDefinitions(LogicalName='"+r[i].LogicalName+"')?$expand=Attributes($filter=MetadataId%20eq%20"+id+")");oReq.send();break;}}}id=prompt("Enter Attribute ID", "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");var oReq=new XMLHttpRequest();oReq.addEventListener("load", getAtt);oReq.open("GET","api/data/v9.0/EntityDefinitions()?$select=LogicalName&$expand=Attributes($select=LogicalName;$filter=MetadataId%20eq%20"+id+")");oReq.send();

You can paste the attribute ID and receive the logical name of the attribute and of its entity. On top, you can open the browser console to inspect the full output of the WebApi for the attribute.