Tip #1428: Replace Power Automate triggers without breaking too much, Part 1

Always stash trigger output into variables or compose before continuing with the flow. If your trigger output contains a record from the underlying storage (Dataverse, SharePoint, etc) get that record and use the output of the get step downstream.

Why? Because when you need to replace or recreate a trigger (happens more often than you think), you would have to recreate the reference in one place only. Have you used the trigger output throughout the flow, trigger deletion would mop it all up and break every single step where the output was used. Go fish!

Don’t do this:

Do something like this instead:

Why? Because when you delete the trigger in the first example, both compose steps will be broken. In the second example only Parse Json step will require a fixup but the rest of the flow will be fine.

Getting triggering record has additional advantage. Sometimes the triggers (looking at you, Microsoft Dataverse) tend to overlook certain properties like formatted values, @odata.id, etc. Getting the record as the first step ensures you get up to date values for all columns that you might be interested in.

In other words:

Do not use trigger output beyond the first step in your flow

Bitter Enabler

Cover image courtesy of Schäferle | Pixabay

Tip #1427: Single letter custom formats for dates in Power Automate cloud flows

Today’s tipster is Elaiza “What The Flow” Benitez. (And you can be a tipster too, just send your gem to jar@crmtipoftheday.com!)

“Froyo Queen” Azure McFarlane mentioned in a birdie chat that she was having trouble with formatting the month value using the formatDateTime function in Power Automate cloud flows. She was attempting to only retrieve the month value without the leading 0.

The expression applied was formatDateTime(utcNow(), 'M') but the output returned is the following:

(Problem is that standalone ‘M’ (and bunch of other letters) is not treated as a custom format at all but as one of the standard formats. – t.j.)

Solution: prepend the % character in the expression like this: formatDateTime(utcNow(), '%M')

Ta da!

Special thanks to The Enabler (that’s me ☺️ – t.j) for pointing to the documentation that specifies this.

Another mystery solved! #ScoobyDoo

Cover image by congerdesign | Pixabay

Tip #1426: Power Automate Gymnastics Reference Guide

Power Platform Tip of The Day presents: Power Automate expressions you didn’t know you needed until you found them. Everyone keeps a stash of useful Power Automate expressions in Notepad++, VS Code, EMacs, vi, or sticky notes if you don’t know what any of the above mean.

Good citizens and developers (Amey “ABC” Holden, Antti Pajunen, Matt Collins-Jones) got around the campfire and put together

Power Automate Gymnastics Reference Guide
(Yes, I am a link to that page, please click me)

The expressions are ready for you to copy and paste without coding.

It doesn’t count as code if you copy and paste

Amey “ABC” Holden

Have a favorite expression of your own? Drop it in the comments or send it straight to jar@crmtipoftheday.com.

Tip #1425: Dataverse CSV import using alternate keys

Today’s tip is from Alex McLachlan (@alex_mcla), saving the day (no kidding – I used it the very next day after receiving the tip). You can be a hero too by emailing your tip to jar@crmtipoftheday.com!

With the classic import experience, you couldn’t use a CSV import containing an Alternative Key column to update existing records. See (2) Update existing records on import (using alternate keys – account number)??? – Microsoft Dynamics CRM Forum Community Forum

Now with Import from Excel > Import from CSV gives:

Screenshot of the standard Import from CSV settings dialog. New setting allowing selection of the alternate key is highlighted.

Selecting the Alternative Key then allows update of existing records in the CSV file. The Alternative Key needs to be included in the Data Mapping.

Tîpp Jäår $0.02 + GST

If you’d like to consume a video, Power CAT team has one just for you:  Easier Imports With Dataverse Alternate Keys – Power CAT Live – YouTube.

Cover image by hudsoncrafted | Pixabay

Tip #1424: The user does not have sufficient access right to run flow with custom connector

I’ve tried all the right things:

  1. Created, deployed, and configured custom connector into the target environment before importing the solution that uses the connector. All tests pass.
  2. Created a manual Power Automate flow as part of the solution.
  3. Shared the flow with the user (should not need to for the solution flows but just in case)
  4. Ensured that the flow runtime permissions are set correctly (correct use of run-only permissions)
  5. Shared custom connector with the user (should not need to but just in case)

And yet, when the said user tried to run the flow they kept getting this error message

Screenshot of an error message that reads:

The user '39b162da-9c30-eb11-a813-000d3a7953be' does not have sufficient access rights to perform this operation on entity with id c4bd1890-3b2f-43d5-8153-31b9e8487241 in instance with URL 'https://redacted.dynamics.com/'. Required access right 'ReadAccess' is missing.

This flow uses the following apps. A green check means you're ready to go.

This information seems to be helpful but then it generates more questions than answers:

  • Operation on entity with id XXX. Is that a record with that id or id of the actual entity/table?
  • What entity/table are we talking about here?
  • The flow uses unspecified list of apps – what is the relevance of this?

Long story short: user was missing read privileges on Connector table (and id mentioned is the id of the entity/table not of the record in the table). There are two Connector tables on the most instances I’ve seen and, just like the USB, you are going to get the first one wrong. There is an easier solution to the problem: assign Basic User role to the user. One of the permissions it includes is that very permission to read custom connectors (what did you think is in the Connector table?!).

Cover image by ds_30

Tip #1423: Search for solution that does not exist

You are about to record or present a demo but your environment contains all the demos you performed previously and looks like this (zoomed out for brevity):

What you are about to do next is what I call the “sweeping under the rug”:

Search for the solution that does not exist yet

Thee Nabler

If you are about to create a demo solution Unicorns and Gluten, search for it first then your screen will be clean as a whistle:

And once created, solution will be the only one present. Nice and clean demo ahead.

Congratulations, you just successfully performed the “sweeping under the rug” manoeuvre.

Cover photo by Bob van Aubel on Unsplash

Tip #1422: Leave old stuff behind

Let me start 2022 slowly, with a tip how to avoid annual cleanup. It all started with this email:

Screenshot of the email that reads:

Hope you are well and are going to get a break over Christmas!
I got a notification of you making changes in your Dropbox – feel free to remove me if you like (see attached)
IT Engineering Team

Darn, I completely forgot about those folders and big thumbs up to Richard for reminding me. Richard is one in a million though, most would simply ignore the shared folders. Until such time when you drop some sensitive files in there.

How to avoid this unnecessary stress and reliance on Richards of this world to do the right thing? Simples:

Always set the expiration date when sharing folders or files

Thee Nabler

I don’t care what it is. Could be tomorrow, could be 5 years from now. But do set it and spare yourself potential embarrassment at best and the jail time at worst (I’ve seen it in a movie, totally plausible scenario). Almost like in the song:

Go ahead and share but trust no one. (So much for faith in humanity in 2022)

Cover image by Gerd Altmann

Tip #1421: Hide form selector in model-driven apps

Everybody take a seat. Tanguy WiTouzard has the floor. (You can grab everyone’s attention too by sending your useful tip to jar@crmtipoftheday.com)

Wizardry starts here

I don’t know if it was published before but I just found out that we were able to remove “forms” from “form selector” using Javascript. It’s really useful when you have many forms because you are creating forms for different purpose but don’t want users to be able to switch themselves to those forms.

Screenshot of a form in a model-driven app. Form selector is visible and shows multiple forms available to the user to select from.

So let’s say, I have so many forms for account entity (see screenshot), I can remove the form selector by using the following script.

function disableFormSelector(){

Voila! Sans sélecteur de formulaire!

(Tanguy actually didn’t say anything here but I’m not missing the opportunity to flex my Google-inspired French skills – t.j.)

Screenshot of a the same form as before in a model-driven app. Form selector is no longer visible after the  javascript fragment execution.

(And I have no idea why Tanguy gets involved with piscines this time of the year. And why would swimming pools need a résumé? I guess he’s looking for a new job trying to finance his new swimming pool. 😈 – t.j.)

Cover image by PhilippT | Pixabay

Tip #1420: JSON Function and size limits in Power Apps

Power Fx (gotta use the cool keyword!) JSON function in Power Apps is pure magic, it’s like a compactor converting anything you throw into it into a neat text representation to send over the wire, engrave on a golden bullion, or stash it as an alphabet soup. It works great apart from the times when it does not.

Turns out, it’s got a 0.5MB size limit. Give it anything that produces longer string than that and get blank in return. No error, no messages, no trace. Nothing. Blank. Blankinness. Nothingness. Ouch.

Now you know.

Cover photo by Sarah Kilian on Unsplash

Tip #1419: Dual-write 404 error when metadata contains special characters

As Power Platform extends its reach beyond the realms of Dynamics 365 (CRM/CE/etc) and SharePoint, we’re starting to see some interesting integration challenges from Dataverse big brother – Finance and Operations. Today’s tip is from Parth Bhaidani. (Hey, you can have your name published here too – just drop your sizzling tip into jar@crmtipoftheday.com!)

Dual-write provides tightly coupled, bidirectional integration between Finance and Operations apps and Dataverse. However, at times it could be trickier to address the issues. Recently, I was working on a Dual-Write integration and one of the tasks was to add a new Table map. Prima facie the task was fairly straightforward until I stumbled upon the error, “The remote server returned an error: (404) Not Found. Unable to retrieve metadata for AX environment“. Turns out the name of the Table on the F&O side has a forward slash (/) in it (Country/regions) and that’s the reason for the error above.

To fix this issue, we would have to create a new Data Entity but without special characters. (Luckily, in F&O we can create multiple entities for the same underlying table – t.j.)

  1. In the F&O environment go to Data Management Workspace -> Data Entities
    F&O Data management interface with Data entities button highlighted.
  2. Search the Table name for which you are trying to add the Table Mapping (in my case Country/regions) and copy the Target entity name.
    Country/region table selected in the table mappings with Target entity column value highlighted.
  3. Click New and populate Target entity with the copied Target entity from the above step, everything else will be auto populated and leave those columns as is. Click Save.
    New table entry without special characters
  4. Add the Table Mapping using the new name (which is again the one copied in Step 2). Now, you should be able to add mapping without any issues.

Cover photo by Vincent van Zalinge on Unsplash