Use Power Automate to alert the credit team that there is a new customer in Dynamics 365 Finance & SCM

 

Business scenario – Sales team needs to be able to add a new customer to Dynamics 365 Finance, but before the customer is used in Sales the Credit Team needs to review the record and set the proper credit limit and payment terms.  The customer should automatically go on hold until the review is complete, and an email should alert the Credit Team to act.

Components used in the scenario – Dynamics 365 Finance business alerts and Power Automate

Synopsis – By combining the business alert functionality of D365 with Power Automate the system can automatically manage this business process.  Power Automate will watch for a new customer to be added in D365.  When the new customer is added, Power Automate will automatically put the account on Hold with a status reason of New.  Power Automate will also send an email to the Credit Manager including the information from the new customer as well as a link to the On Hold Customers in D365.

Step 1 – Create a custom alert rule on All Customers

From the All Customers screen – options ribbon – share – Create a custom aler



For the alert rule – event should be “Record has been created” and select “yes” for send externally.  Make a note of the Rule ID as this will be needed in Power Automate

Step 2 – Verify change-based alerts are running

Go to System administration – Inquiries – Batch jobs

Search for description of Change based alerts


Verify the batch job is running on a recurring basis – this job is required to trigger the necessary alerts.

Step 2a – Set up change-based alerts (if not running)

Go to System administration – Periodic tasks – Alerts – Change based alerts and setup to run on a regular occurrence using the Recurrence tab

Step 3 - Download the schema of the business event

Go to System administration – Setup – Business events

Find the category = “Alerts” and Business event ID = “BusinessEventsAlertEvent”

Download the schema – this text file will be needed to parse the Json in Power Automate.


Step 4 – Set up Flow in Power Automate

Load Power Automate – flow.microsoft.com

Create a new flow – “Automated cloud flow”

The flow trigger is “When a Business Event occurs” from Fin & Ops Apps (Dynamics 365)


Step 4.1 – Setup Business Event

Select the correct instance for Dynamics 365 Finance

  • Category = Alerts
  • Business event = When an alert rule is triggered
  • Legal entity = select the appropriate legal entity



Step 4.2 – Convert the data from the business event

Add a step of “Parse JSON”

Content = “body” from the Business Event

Use the text file of the business event schema above to generate the schema, but pasting it in the “generate from sample”



Step 4.3 – Filter for the applicable business alert rule

Add a condition step

Used “RuleId” from the Parse JSON step “is equal to” Rule Number (the rule number is from Dynamics 365 Finance when the original alert was created.  If you need the rule number, go to “manage my alerts” on the All Customers form

Step 4.4 – Setup the Yes side of the condition

This example there will be no action taken if the rule id is false or no.

If yes will include three steps

  • Get the customer record
  • Update the customer record
  • Send an email to credit team

Step 4.4.1 – Get the information on the new customer

Prior to updating the customer record, it is necessary to locate all of the information on the new record including the customer group and currency.

Add an action in the If yes section.  The connector is Fin & Ops Apps(Dynamics 365) – Action is “Get a record”

Select the correct instance for D365 and use the CustomersV3 entity.  The object id is a combination of the data area id and account number.  You can select these fields from the Parse JSON step.  KeyValue1 is equal to the account number.

Step 4.4.2 – Update the customer record information

Prior to updating the vendor record, it is necessary to locate all of the information on the new record including the Unique ID.

Add a step – “Update a record” from Fin & Ops Apps(Dynamics 365) connector

Select the correct instance for D365 and use the CustomersV3 entity.  The object id is a combination of the data area id and account number.  You can select these fields from the Get Record  step above.  Company is the data area id and Customer account number is the account number. Be sure to include a comma between the two fields.

Currency and Customer group are required fields.  They can be selected from the Get records step above. 

Show advanced options to access other fields that you desire to up date.

Invoicing and delivery on hold = is the hold status.  This is a drop down, select All

Account status reason = the reason the account is on hold

It is possible to update any other fields including delivery terms, payment terms, credit information, etc.



Step 4.4.3 – Send email to the credit manager

Power Automate automatically add the Apply to each step, since prior step used List Rows and there could be more than one result.

Add a step – “Send an email” from Office 365 Outlook connector

Enter the email address of the credit manager

Enter the subject and body of the email.  It is possible to use dynamics content from the Get record step to include information on the new customer, like the organization name, email address, address, etc.

If you would like the credit manager to be able to quickly get to any customers that are currently on hold you can include a link to the Customers on hold list page – “dynamics365url.com/?cmp=LEGALENTITY&mi=CustTableHoldListPage”

Step 5 – Add a new customer and test

Save the Flow in Power Automate

Return to Dynamics 365 Finance – add a new customer

Allow two to three minutes for the alert to run.  The customer should be changed to on-hold  and an email should be sent.

Summary

This is just a simple example of how you can use Power Automate with Dynamics 365 Finance and Supply Chain.  You could follow the same approach to handle vendor onboarding and for adding new products.  Power Automate could even load journal entries, or other transactions.  I have a few other ideas that I will try to create, so look for more articles soon.

Comments

Popular posts from this blog

Creating a date table with a fiscal year in your Power BI data model

Showing the last 12 months based on a date slicer

Using Excel, OneDrive and Power Automate for Dynamics 365 Finance & Supply Chains Journals