Tip #1256: Get attribute of the first record from the list

This is probably a super simple question, but I’m a super simple flow user. After listing records from D365 how would I go about retrieving an attribute value of the first result returned?

Michael “Super Simple Flow User” Ochs

I won’t name the person who suggested the following:

  1. Declare variables to store values.
  2. Include top 1 limit for your query.
  3. Loop through your set (so 0 or 1 record) and set required values to variables.
  4. Use it and enjoy.

You know who you are, Andrii “Granny’s Moonshine” Butenko, and credit is where credit due – step 2 is actually correct if you only need that one record. I guess step 4 is also correct when you get something right.

The way I would do it:

  1. Build the query using filter, orderby and top to get exactly what I am after.
  2. Use expression to get the attribute while avoiding the runtime errors.


Let’s say I have an account and I want to find the full name of child contact created last.

Build the query by filtering contacts on the parent account, ordering the results by createdon in descending order (so that the last created contact is on top), then limiting results to 1.

After that, use the following expression to get the full name of the first contact returned.


Note that the query may or may not return any results so we use question mark operator (?) to avoid runtime errors.

To reference null properties in an object without a runtime error, use the question mark operator.

Workflow Definition Language schema

The result is either the full name or empty (if account has no contacts).

The only downside of using the expression (besides being not-exactly-nocode) is that the expression won’t know when you rename the List Records step. Which is why Tip #1247 is important.

Cover photo by unsplash-logoCupcake Media

Tip #1255: Say hello to PowerApps Component Framework

At long last we have that abbreviation sorted out. CCF PCF or PowerApps control Component Framework a.k.a. Goodbye Web Resources is now available for public preview. It sounds grand and does hold the promise of changing the way we extend PowerApps, both model-driven and canvas.

Read the announcement conveniently placed within the new PowerApps Component Framework (Preview) forum.

Tîpp Jäår action plan

Cover photo by unsplash-logoVadim Sherbakov

Tip #1254: Design Dynamics 365 email templates with the new email editor

In a recent virtual conversation with Steve Mordue, Steve inquired about using the new Unified Interface email editor to create email templates.

While Microsoft has not (yet) gotten around to adding the template creation process to unified interface, there is at least one approach you can take to design your templates in the new email editor.

  1. Create an email in Unified Interface
  2. Add your fancy schmancy formatting
  3. CTRL+a and CTRL+c to select all of the contents of the email body/description.
  4. Create a new email template in the Advanced Settings area.
  5. Select the template body field and CTRL+v to paste the contents.

This will maintain most of the formatting, including images. You can then add in your template specific merge fields.

Cover photo by unsplash-logoPeter Lewicki

Tip #1252: Creating a Planner task with Flow: wait a minute

If you use Microsoft Planner to plan your project tasks, you may want to automate creation of tasks. You can do this with Microsoft Flow.

You will notice that you can’t update fields like the task description when you create a task–this is actually a separate step, called update task details. But if you try to create a Flow that creates a task and immediately tries to update the details, the Flow will fail with a record does not exist error.

To avoid this issue, add a 1 minute delay between creation of the task and update of the details.

Cover photo by unsplash-logoXu Haiwei

Tip #1251: Run workflow when something did not happen

Flow is all the rage these days but there are some scenarios where classic workflow still rules. Classic workflow has the uncanny ability to readjust itself when underlying data you’re waiting for, changes.

This dialog took place not so long ago:

Steve “Reads his own blog” Mordue: I want to trigger a workflow to update an account record if a case has not been created in the last 30 days for the account. Any ideas?

Yours truly: So let me get this straight… You want to run a workflow when something does not happen. That’s a new one.

SM: Yes

YT: How about this.

  1. Create a field on account ‘Last case created on’. Have a workflow that fills that in with the current date on case create.
  2. Have another workflow waiting on that field that kicks in 30 days after the date. It will readjust itself as the field gets updated.

SM: I like it

Just to be fair. If you have bazillions of the accounts and quantamarillions of cases, you might end up with a large number of waiting workflows. Some people have beef with that so those might want to consider Guido “Future olive farmer” Preite‘s suggestion of a scheduled Azure Function to perform the check every day. GP did admit that it was a developer’s suggestion meaning that SM ignored it.

Cover photo by unsplash-logoAnthony Ginsbrook

Tip #1250: Forms won’t load in Chrome

With Joel being busy or lazy, I’m claiming credit for that one even though I have nothing to do with it.

Problem: Classic UI [allegedly – t.j.] has an issue in v8.x where Chrome will just keep ‘spinning’ on some of the forms without returning anything.

Solution: Add an empty JS file to the form.

Explanation: Forms with no custom JS may not properly initialize the OOB script objects. Obviously a Microsoft/Chrome issue but, in a pinch, add an empty js file and that tells Dynamics to go initialize all javascript objects (including its own).

Joel trying to be funny: Legacy form rendering also works if you’re feeling destructive.

Time to upgrade: Unified interface doesn’t have this issue

Tip #1249: Talk back from canvas to model-driven

Until now, embedded canvas apps were a mere eye candy. But with just announced new capabilities you can now talk back to the form. Kind of. More “bark orders” than “talk” but this is awesome start!

Embedded canvas apps now provide the ability to perform actions to navigate, refresh and save the host form. With these capabilities makers can now achieve even richer integration between the embedded canvas app, the host form and other assets in the model-driven app, unlocking an entire new set of scenarios to help meet business needs.

Anees Ansari, Principal Program Manager

Blog post: https://powerapps.microsoft.com/blog/embedded-canvas-apps-can-now-navigate-refresh-and-save-the-host-form/

Documentation: https://docs.microsoft.com/powerapps/maker/model-driven-apps/embedded-canvas-app-actions

Now, how about letting us talk to form context? 😉

Tîpp Jäår

Cover photo by unsplash-logoHarli Marten

Tip #1248: Stop using OrganizationProxy

One of the topics discussed during the MVP Summit 2019 was the brexit of SOAP API. I thought we dealt with it already but there is an additional small but important message:

Stop using OrganizationProxy

Matt “Platform Deity” Barbour

Hold on, you may ask, didn’t you tell us that IOrganizationProxy is fine? Yes, it is, with a capital ‘I’. Interface IOrganizationProxy is fine (and recommended for use in the plugins), but class OrganizationProxy is not. Use CrmServiceClient instead, if you must.

Cover photo by unsplash-logoThomas Le

Tip #1247: Why you should rename your steps in Flow

When you start using Flow, it is tempting to just add your triggers and actions and go, but there is one small detail you don’t want to forget–rename those steps.

For those who don’t know, you can click the … on a step in Flow and select rename.

This will then let you rename the action step to something that makes more sense than “Update record 3.”

So why is that important?

  1. It will save you a lot of time later, especially if you have more than a few steps. If you see multiple actions called “condition,” you will have to click into each one to see what they do.
Renaming the steps makes managing complex Flows easier

2. It will reduce your chances of messing up later. When I insert a dynamic value into a field or expression, I’m presented with all of the field values from each of the triggers and actions before this one–so if you have multiple get contact record actions (or multiple entities with similar sounding fields, like account and contact), you will have to be sure you are picking from the correct one. If you don’t rename your steps, selecting the right one becomes exponentially harder.

The step name is included in the dynamic content selector.

3. It is considerate to those who come after you. If you are building a Flow that your company will be using for important business functions, you will likely not be the only one who ever needs to work on that Flow. By renaming your steps, you will set a good example of Flow best practices for those who work on the Flow in the future, and they will more easily be able to figure out what you did.

Bonus tip–name the steps first

You may find the “rename” option is grayed out and you cannot rename a step. The reason for this is because other steps depend on this step, and you can’t rename a step if it is referenced in a subsequent step.

Can’t rename because a subsequent action references its output

That’s why “build the Flow first then rename the steps” is a bad idea–if you get a complex inter-related Flow going, you will not be able to rename the action steps, causing you to either redo a lot of your work or give up and leave your generically named actions.

Cover photo by unsplash-logoBrett Jordan