Introduction to Azure Logic App
- Azure Logic App is a cloud-based service provided by Microsoft Azure that enables users to automate workflows and business processes using a visual designer and built-in connectors.
- One of the key advantages of Logic App is that it does not require any coding skills to design and build workflows, making it accessible to users with varying levels of technical expertise. It integrates with Azure services, third-party services, and on-premises systems, providing automatic support for different business needs, faster integrations, and development of cloud applications with minimal coding.
- Users can trigger Logic App workflows based on events, timers, or manual inputs. These workflows can process data, send notifications, and interact with databases and other systems, which can help businesses streamline their processes, automate tasks, and increase productivity.
- Logic App offers enterprise-level security, monitoring, and scalability, making it a suitable solution for businesses of all sizes. Its user-friendly interface, automatic support for different business needs, and enterprise-level security make it an attractive option for businesses of all sizes looking to streamline their operations and improve productivity.
Functioning of Logic App
- A logic app always begins with a single trigger, which initiates when a specific condition is met. The trigger can be activated by an event or data that meets certain criteria, and some triggers have scheduling features that enable users to determine the frequency of their workflow.
- Following the trigger, one or more actions are performed to process, or transform the data that flows through the workflow or to move the workflow to the next stage.
Integrating Azure Service Bus with Logic App
- Integration from Service Bus Explorer to D365 F&O via Logic App can enable business operations, such as invoice posting.
- To accomplish this integration, it is necessary to establish a connection between Service Bus Explorer and Logic App, as well as integrate Logic App with D365 F&O.
- An Azure-based messaging service, such as Service Bus, allows for the storage of messages in a queue for future retrieval. When a message is transferred, both the message broker (Service Bus) and client must determine whether the message was processed successfully and can be removed, or if the message delivery or processing failed and must be re-delivered.
Messaging service Workflow
- The process of custom integration involves utilizing JSON messages to transfer approved transactions from the source application through Azure Service Bus. This is achieved through a custom Logic App, which will access a custom D365FO method to create and post Journals.
- Messages originating from Service Bus Explorer are assigned unique IDs that act as reference IDs for each JSON message sent. Once the Logic App processes the message received from Service Bus Explorer, a response is sent back to Service Bus Explorer, and if the message processing is successful, the respective invoice ID is posted in D365 F&O.
Below is the diagrammatic representation of the general flow of invoice processing.
In this flow, the invoice posted from a 3rd party application sends the data in the form of JSON via Azure Service Bus. Logic App will process the JSON message from Service Bus and access the D365 F&O Custom methods for D365 data and post the transaction in the respective Journal.
The Importance of Configuration in D365 F&O
- Whenever a message with a unique ID that has already been posted enters the Logic App from Service Bus, the Logic App will log the message in the “Logic App log” form.
- This form can be accessed in D365 F&O under System administration > Setup > Azure logic app > Logic app log.
- In the event of a failure in posting an invoice to D365, there have been cases where the messages get stuck in the Service Bus queue. This can affect the performance of the Logic App since it continuously attempts to process the document.
- To resolve this issue, a threshold can be set on the number of runs by document to identify the recurrence of messages with a unique ID and alert a specific group of people via email regarding the recurrence.
The threshold limit will be validated against each of the following Logic Apps.
- Vendor invoice non-PO LA.
- Vendor invoice PO LA.
- Vendor invoice journal create and post LA.
- Customer Invoice post LA
- Purchase order create LA.
- Expense journal post LA
- Hour journal post LA
Setting Up Logic App Log Parameters in D365 F&O for Efficient Threshold Checks
- To ensure the efficient performance of Logic App, a parameter form should be created in D365 F&O to set up the threshold value for the number of unique message recurrences.
- The form should also include details of email recipients who should be notified in case the threshold limit is exceeded. This threshold check should be independent of both Legal Entity and Logic App.
- The new menu item, named “Logic App Log Parameters,” should be located at System Administration > Setup > Azure Logic App > Logic App Log Parameters.
Message reprocessing notification Logic App log parameter form
The fields listed below will be placed under the blade “Message reprocessing notification” present in the Logic app log parameters form.
Email will not be trigger for below Scenarios
Even though the configuration is set to notify the user for repeated occurrences of Unique ID, the below scenarios will not notify the user with an email when,
- Single Failure — If an invoice fails at any step of the logic and the corresponding failure message is sent back, there should not be an email sent.
- Multiple failures but within the time threshold — An invoice previously failing in the Logic App can be reprocessed at a different time (multiple times), fail again, and not send the email.
- To sum up, D365 F&O is designed to send out an email notification to the configured recipients if a Logic App processes the same message multiple times beyond the threshold limit specified in the parameter form. This notification is triggered when the unique ID exceeds the threshold value specified in the parameter form.
- Following the above process, it helps the users to stop triggering the business events continuously in case of failure, which reduces logging the messages being stuck in the service bus queue, thereby preventing the Logic App to process the message continuously. This helps to improve Logic App’s performance in processing the document.
- This solution implemented to address the performance issue in the Logic App is a temporary measure. A more advanced solution would require revising the logic apps to address the underlying cause of repeated runs.