FormatDateTime function in a Flow | Power Automate

DateTime fields from Dataverse / Common Data Service (Current Environment) are retrieved in full Date and Time format. And in common applications, you are required to only retrieve the Date and not the Time. Or even Format the Date Time in a certain way.

Let’s look at how to format DateTime in a Flow which appears as below

Let’s look at a simple example by trying to format a Created On date field.

FormatDateTime function

  1. Let’s a take a variable of type String to store our formatted Date. Now, in the variable, go for Functions and look for FormatDateTime function.


  2. Now, it asks for 2 parameters – TimeStamp and Format.

  3. Since I’m picking the field from the trigger itself, I’ll use the below formula to pick from triggerBody().

    In case you want to also learn how to use triggerBody(), triggerOutputs() or outputs(), you can refer below posts –
    1. Using triggerBody() / triggerOutput() to read CDS trigger metadata attributes in a Flow | Power Automate
    2. Using outputs() function and JSON Parse to read data from missing dynamic value in a Flow | Power Automate

  4. In the second parameter, put the format of the date in single quotations as shown below –


    You can follow this official Microsoft documentation – https://docs.microsoft.com/en-gb/dotnet/standard/base-types/custom-date-and-time-format-strings?WT.mc_id=DX-MVP-5003911

  5. And your Date Format is set. When you run the Flow, you’ll get the formatted date.


    Hope this was quick and helpful!

Here are some more Power Automate / Flow posts you might like to check –

  1. Formatting Approvals’ Details in Cloud Flows | Power Automate
  2. Number Formatting in a Flow | Power Automate
  3. Parallel Branching in Cloud Flows – Isolate Response dependent Step Actions in parallel branches | Quick Tip
  4. Trigger Conditions not working in a Cloud Flow? Here’s Why | Power Automate Quick Tip
  5. InvalidWorkflowTriggerName or InvalidWorkflowRunActionName error in saving Cloud Flows | Power Automate Quick Tip
  6. Read OptionSet Labels from CDS/Dataverse Triggers or Action Steps in a Flow | Power Automate
  7. Run As context in CDS (Current Environment) Flow Trigger | Power Automate
  8. Setting Lookup in a Flow CDS Connector: Classic vs. Current Environment connector | Power Automate Quick Tip
  9. Make On-Demand Flow to show up in Dynamics 365 | Power Automate
  10. Task Completion reminder using Flow Bot in Microsoft Teams | Power Automate

Thank you!!

Use Rich-Text Control for Multiple Lines of Text in Dynamics 365 CE | Quick Tip

With the addition of the Rich Text Control, your Multiple Lines of Text field can make a lot more sense than before.

Standard Control

Your usual control for Multiple Lines of Text looks like this

Rich Text Control

Now, you can turn this into a Rich Text Editor
Here’s how you do it –

  1. Go to the Multiple Lines of Text field, in this case, Description field.
    select the inner control and click on Properties


  2. Now, look for Controls tab and click on Add Control as shown below

  3. Look for Rich Text Editor Control

  4. Make sure you select the new Control on all formats (or wherever you want to apply)

  5. Once you apply changes and publish, the new Control will be available for you to use.


Hope this was useful. Here are some more Dynamic 365 posts which you might want to check –

  1. Ribbon button visibility based on a field value in Dynamics 365 | Ribbon Workbench
  2. Get GUID of the current View in Dynamics 365 CRM JS from ribbon button | Ribbon Workbench
  3. Make On-Demand Flow to show up in Dynamics 365 | Power Automate
  4. Find deprecated JS code used in your Dynamics 365 environment | Dynamics 365 v9 JS Validator tool | XrmToolBox
  5. Remove ‘This Email has been blocked due to potentially harmful content.’ message in Dynamics 365 Emails | OrgDbSettings utility
  6. Track and Set Regarding are disabled for Appointments in Dynamics 365 App For Outlook message | Demystified
  7. Mailbox Alerts Hide/Show behavior in Dynamics 365 CRM
  8. Dynamics 365 App For Outlook missing on SiteMap in CRM? Use shortcut link [Quick Tip]
  9. Pass Execution Context to JS Script function as a parameter from a Ribbon button in Dynamics 365 | Ribbon Workbench
  10. Find Created On date of solution components in Solution Layers | Dynamics 365 [Quick Tip]

Thank you!

Ribbon button visibility based on a field value in Dynamics 365 | Ribbon Workbench

Most times, requirement is as simple as being able to show or hide a ribbon button based on a value of the field on the record.

Scenario

Let’s consider this scenario, a button on Lead entity called as “Evaluate” exists. It should be only visible if the Lead Source (OptionSet) is set to Partner.


And the button should be hidden if the condition is not satisfied.

Enable Rule based on Value

Now, let’s see how we achieve this –

  1. In Ribbon Workbench, in your Command which is tied to the button, you need to add a Display Rule.

  2. In the Display Rule, you’ll need to select ValueRule.

  3. In the value Rule, you’ll need to specify the field name and the value to consider.
    So here, the field I want to consider is “leadsourcecode” i.e. “Lead Source” field on the Lead entity and 4 is the value of the Partner option.


  4. and finally make sure your Display Rule is correctly tied to the Command on the button (And yes, the Command should also be tied to the Button itself.)

  5. And finally Publish your changes.

Execution

Now, when the Lead has value as Partner, the button will be visible

And when the value is something else, it will be hidden once the record is saved.

Note: In this case if your condition is based on multiple values, consider adding more Display Rules and patch them together using OrRule as one Rule will cater to only 1 value.

Hope this helps!

Here are some more Ribbon Workbench related posts you might want to check out –

  1. Get GUID of the current View in Dynamics 365 CRM JS from ribbon button | Ribbon Workbench
  2. Pass Execution Context to JS Script function as a parameter from a Ribbon button in Dynamics 365 | Ribbon Workbench
  3. Pass selected rows’ GUIDs to ribbon button in D365 | Ribbon Workbench
  4. Debug Ribbon button customization using Command Checker in Dynamics 365 CE Unified Interface
  5. Show Ribbon button only on record selection in Dynamics CRM
  6. Hide Custom Ribbon Button [Easy Way] – Ribbon Workbench
  7. Enable Flow button on D365 Ribbon
  8. [SOLVED] Navigating URL from Ribbon’s custom button in Dynamics for Phones app
  9. Create a New Record button for Activity Type entity using Ribbon Workbench: D365
  10. D365 Ribbon Button shortcut to open a Document in SharePoint Online

Thank you!!

Formatting Approvals’ Details in Cloud Flows | Power Automate

Now, not always Approvals details/description should appear as plain text. In order to enrich the Details of an Approval Adaptive Cards (which you can send as part of standard Approvals provided by Cloud Flows / Power Automate)
In this post, I’ll be looking at an example to format Details for a “Start and wait for an approval” Action step in Power Automate / Cloud Flow


You can enrich the Details so that they appear easy to read and are more meaningful.

Scenario

Let’s say I receive the below Approval with the Details mentioned as below.

And the Details section as you see appears bland without formatting. Let’s format the same using some Markdown examples.

Markdown Support for Details in Approvals in Cloud Flows

  1. If you select Approvals and notice the Details field, you’ll see a watermark saying that Markdown is supported.

  2. Markdown is a light-weight markup language for formatted text. MS Docs Official Link for all Markdown usage: https://docs.microsoft.com/en-us/power-automate/approvals-markdown-support?WT.mc_id=DX-MVP-5003911
  3. Let’s look at how the below plain text can be enriched using Markdown

  4. Now, understanding how Markdown is used from the documentation provided above, you can format the details as below –

  5. And the formatted Details section looks more meaningful and appealing.

Hope this helps!

Here are some more Power Automate / Cloud Flows posts you might want to look at –

  1. Trigger Conditions not working in a Cloud Flow? Here’s Why | Power Automate Quick Tip
  2. Read OptionSet Labels from CDS/Dataverse Triggers or Action Steps in a Flow | Power Automate
  3. Parallel Branching in Cloud Flows – Isolate Response dependent Step Actions in parallel branches | Quick Tip
  4. InvalidWorkflowTriggerName or InvalidWorkflowRunActionName error in saving Cloud Flows | Power Automate Quick Tip
  5. Using outputs() function and JSON Parse to read data from missing dynamic value in a Flow | Power Automate
  6. Create a Team, add Members in Microsoft Teams upon Project and Team Members creation in PSA / Project Operations | Power Automate
  7. Adaptive Cards for Outlook Actionable Messages using Power Automate | Power Platform
  8. Make On-Demand Flow to show up in Dynamics 365 | Power Automate
  9. Run As context in CDS (Current Environment) Flow Trigger | Power Automate
  10. Call HTTP Request from a Canvas Power App using Flow and get back Response | Power Automate

Thank you !!