Trigger Microsoft Flow on click of custom ribbon button in Dynamics 365

By | December 17, 2018

Introduction:

In this blog, we will discuss a workaround for triggering Microsoft flow via Dynamics 365 custom ribbon button.

For this, We would place a hidden two option field on form and then we would toggle its value to true via custom ribbon button and save the record, we would need to keep the triggering point of our Microsoft flow at “When a record is updated in Dynamics 365” so it would detect the change in the record and would trigger flow, but since we would not want it to be triggered on updating of any other field so we would also add a condition which would check that our two option field value is set to true, if yes then only further flow logic should get executed else the flow would exit.

Steps:

  • Create a custom ribbon button: You can use XrmToolBox or Ribbon Workbench tool to create a button in your respective entity from where you may want to trigger your flow.
  • Write JavaScript: You would need to write a javascript file which would contain your function which will toggle the value of a hidden field and also save the record so that the updation event would be recognized by the flow
  • Prepare Microsoft flow: The entry point of your flow will be via Dynamics 365 Connector > When a record is updated. After that first condition will be to check whether the toggle field was modified as shown in the following screenshot

Trigger Microsoft Flow on click of custom ribbon button in Dynamics 365

  • Perform your operations: Once we check the condition to make sure that the event was from toggle field and not from any other field, we would perform a send email operation (may vary depending on your requirement)
  • Toggle the two options field to false: We would need to make sure that the toggle field is rolled back to false because if the field remains in as-is condition then it will be difficult to check whether the event was fired from this field or from other fields, hence make sure to rollback the value of the hidden two options field once you are done with your work.

Conclusion:

Hope the above steps help to achieve your objective of triggering flow via Dynamics 365 ribbon button. To know more about Microsoft Flow read our blog series.

Free 70% of storage space in CRM with Attachment Management Apps!

Attach2Dynamics – Store and manage documents/attachments in cloud storage of your choice – SharePoint, Dropbox or Azure Blob Storage from within Dynamics 365 CRM.
SharePoint Security Sync – Robust and secure solution to integrate Dynamics 365 CRM and SharePoint Security Sync thereby ensuring secure access to confidential documents stored in SharePoint.