How to Set Date-Based Alerts in Dynamics 365

Reading Time: 4 minutes

Share:

With the release of Dynamics 365 (D365) for Operations, one of the most often requested missing features was alerts.  Flow is often mentioned as a replacement and triggers for D365 for Operations—coming in the near future—will provide a wealth of functionality compared to the alerts of Ax 2012.

That said, they can take a bit more work to get things going, like a past due date alert for a purchase order line.

Let’s take an example. I want to send an email message to my team for every purchase order line that is more than 5 days late per our requested receipt date.

First things first – you’ll need to sign up for Flow.

Once you’ve done that, click on “My flows” and “Create from blank.”

In the flow designer, give the flow a name.

Then from the services and triggers list, select “Schedule.” This will allow us to run our flow on a recurring basis, such as on a nightly basis.

Specify the frequency and interval, and use the advanced options to pick a specific start time if necessary.

Next, we will get records from D365. Click “New step” and select “Dynamics 365 for Operations – Get records.”

 

You’ll be asked to sign in if you have not used this action before. Once signed in, select the D365 instance you want to connect to, and then select the entity “PurchaseOrderLines.”

Click “Show advanced options” and enter a filter.

Our filter for this example will have two parts: selecting only open lines and then filtering on the requested delivery date.

The purchase order status field is an enum and requires a little extra work to filter on. The format required is the following:

FieldName eq Microsoft.Dyanmics.DataEntities.Enum’Value’

This then equates to:

PurchaseOrderLineStatus eq Microsoft.Dynamics.DataEntities.PurchStatus’Backorder’

The ‘eq’ is the expression for equality (see the full list here –

https://msdn.microsoft.com/en-us/library/hh169248(v=nav.90).aspx).

The date field is a little tricky. Something not immediately obvious with Flow is that you can use a lot of the same functionality as LogicApps even though it is not exposed on the designer. So to calculate our date (today – 5) we can make two LogicApp API calls.

The utcnow function will return the date and time as of when the Flow is executed.  We pass one parameter—the format of the date we want returned to us.

We pass the result of the utcnow function call to adddays, which will add, or subtract, the specified number of days to the date it is given. And again, we pass a date format: RequestedDeliveryDate lt @{adddays(utcnow(‘yyyy-MM-dd’), -5, ‘yyyy-MM-dd’)}

The “lt” expression gives us a “less than” condition. Enclosing the above in @{ …} tells Flow that these are function calls to be executed.

So our complete filter expression looks like this:

PurchaseOrderLineStatus eq Microsoft.Dynamics.DataEntities.PurchStatus’Backorder’ and RequestedDeliveryDate lt @{adddays(utcnow(‘yyyy-MM-dd’), -5, ‘yyyy-MM-dd’)}

Next, we add an email action. I’m using o365, but there a multiple methods to send an email. You could also send a text message using Twillio, tweet, etc.

Click in one of the fields and notice the dynamic content displayed on the right-hand side. Click “See more” to reveal all fields from our entity.

Note what happens when you click on a field. Our send action is automatically embedded within a “Apply to each” loop, which will iterate over all the records we select from D365, and send one email for per past due purchase order line.

Compose your subject and body using the dynamics content, mixed with plain text, save, and run!

 

When you run the flow manually, or from the info icon on the “My flows” page, you can view the execution history, and troubleshoot any errors.

Useful References

 

[fusion_builder_container hundred_percent=”no” hundred_percent_height=”no” hundred_percent_height_scroll=”no” hundred_percent_height_center_content=”yes” equal_height_columns=”no” menu_anchor=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”white-text” id=”” background_color=”#003B5C” background_image=”” background_position=”center center” background_repeat=”no-repeat” fade=”no” background_parallax=”none” enable_mobile=”no” parallax_speed=”0.3″ video_mp4=”” video_webm=”” video_ogv=”” video_url=”” video_aspect_ratio=”16:9″ video_loop=”yes” video_mute=”yes” video_preview_image=”” border_size=”” border_color=”” border_style=”solid” margin_top=”” margin_bottom=”” padding_top=”50px” padding_right=”” padding_bottom=”50px” padding_left=”50px”]

Learn more tips and tricks in Dynamics 365 with our monthly newsletter

[gravityform id=”14″ title=”false” description=”false”]

 

[/fusion_builder_container]

This publication contains general information only and Sikich is not, by means of this publication, rendering accounting, business, financial, investment, legal, tax, or any other professional advice or services. This publication is not a substitute for such professional advice or services, nor should you use it as a basis for any decision, action or omission that may affect you or your business. Before making any decision, taking any action or omitting an action that may affect you or your business, you should consult a qualified professional advisor. In addition, this publication may contain certain content generated by an artificial intelligence (AI) language model. You acknowledge that Sikich shall not be responsible for any loss sustained by you or any person who relies on this publication.

SIGN-UP FOR INSIGHTS

Join 14,000+ business executives and decision makers

Upcoming Events

Upcoming Events

Latest Insights

About The Author