Cheat Codes

Trigger Conditions

1) Simple boolean flag on the trigger

textCopyEditequals(triggerBody()?['RunAutomation'], true)

Ref: Power Automate Trigger Conditions made EASY

2) Only run flow Mon–Fri, 8:00–18:00 (Eastern Time)

Note: end time set to 18:00 for 6pm.

@and(
greaterOrEquals(
formatDateTime(convertTimeZone(utcNow(), 'UTC', 'Eastern Standard Time'), 'HH:mm'),
'08:00'
),
lessOrEquals(
formatDateTime(convertTimeZone(utcNow(), 'UTC', 'Eastern Standard Time'), 'HH:mm'),
'18:00'
),
not(equals(formatDateTime(convertTimeZone(utcNow(), 'UTC', 'Eastern Standard Time'), 'dddd'), 'Saturday')),
not(equals(formatDateTime(convertTimeZone(utcNow(), 'UTC', 'Eastern Standard Time'), 'dddd'), 'Sunday'))
)

Expressions

1) Safe-assign a lookup only if value exists (else null)

if(
empty(outputs('Get_Initial_PR')?['body/_mb_relatedpatientvisit_value']),
null,
concat('mb_patientvisits(', outputs('Get_Initial_PR')?['body/_mb_relatedpatientvisit_value'], ')')
)

2) Get the first record’s GUID from a “List records” output

first(body('List_Accounts')?['value'])?['accountid']

3) Date formatting

formatDateTime(variables('VariableName'), 'MM/dd/yyyy')
formatDateTime(utcNow(), 'MM/dd/yyyy')

4) Currency formatting (with thousands + 2 decimals)

concat('$', formatNumber(float(items('Apply_to_each')?['mb_licenseholdertotal']), '#,0.00'))

5) “Due date” minus 2 days, skipping weekends

outputs('Compose') should be an ISO date/time.
Mon → -2 days, Tue → -3 days, else → -1 day.

If(
equals(dayOfWeek(outputs('Compose')), 1),
addDays(outputs('Compose'), -2, 'yyyy-MM-ddTHH:mm:ssZ'),
If(
equals(dayOfWeek(outputs('Compose')), 2),
addDays(outputs('Compose'), -3, 'yyyy-MM-ddTHH:mm:ssZ'),
addDays(outputs('Compose'), -1, 'yyyy-MM-ddTHH:mm:ssZ')
)
)

OData Filter Snippets

1) Two conditions

mb_approvalstatus eq 100000005 and mb_sketchsubmitted ne true

2) Visit type equals “Hygiene PV”

Mb_bookingvisittype eq 100000001

3) Trigger-body equals “Dental PV”

@equals(triggerBody()?['mb_bookingvisittype'], 100000000)

Email (HTML) Snippets

1) Link to a Dataverse record (UCI)

<p>
Link:
<a href="https://sheridan.crm.dynamics.com/main.aspx?appid=f034a65f-83de-eb11-bacb-002248218b73&amp;pagetype=entityrecord&amp;etn=contact&amp;id=@{outputs('Get_Patient')?['body/contactid']}">
Go To Record
</a>
</p>

2) Link directly to the current failed flow run (great for alerts)

<p>
Link:
<a href="@{concat(
'https://emea.flow.microsoft.com/manage/environments/',
workflow()['tags']['environmentName'],
'/flows/',
workflow()['name'],
'/runs/',
workflow()['run']['name']
)}">
Go To Flow Run
</a>
</p>

3) (Optional) Stamp the flow-run URL into an audited text field

concat(
'https://emea.flow.microsoft.com/manage/environments/',
workflow()['tags']['environmentName'],
'/flows/',
workflow()['name'],
'/runs/',
workflow()['run']['name']
)

Model Driven App/Java Script/WebAPI

  1. To Count records, update orgname and entity names and paste this URL in browser:

https://[orgname].crm.dynamics.com/api/data/v9.1/RetrieveTotalRecordCount(EntityNames=[‘contact’,’account’])

  1. Navigate to a custom page: https://learn.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/navigate-to-custom-page-examples
  2. Using audit history in Flow: https://www.bythedevs.com/post/get-record-change-history-of-audited-entities-in-power-automate

Canvas App Snippets

Copy paste the below YAML code into a canvas app screen and you will get an attachment control. For some reason you cannot select it from the insert menu.

-Attachment1:
Control: Attachments@2.3.0
Properties:
AddAttachmentText: =”Upload file”
BorderColor: =Color.Black
Fill: =RGBA(169,169,169,.5)
Height: =250
MaxAttachments: =1
NoAttachmentsText: =”No documents present.”
Size: =16
Width: =400
X: =60
Y: =100

The Podcast

Join Naomi Ellis as she dives into the extraordinary lives that shaped history. Her warmth and insight turn complex biographies into relatable stories that inspire and educate.

About the podcast