We are now a Microsoft Partner for Cloud Platform (Azure)

MRS extends partnership with Microsoft, enhances capabilities to deliver cutting-edge Microsoft cloud solutions for clients.

Read the announcement

Using Flow to Integrate Dynamics CRM and SharePoint

By MRS on Tuesday, November 27 2018

This is a blog post about how we created and stored PDF reports in SharePoint generated from Dynamics 365 data.

Our client is a manufacturing company. After the sales staff visits a client, they are required to fill out a “Visit Report” so that others in the company can review their information. Our client wanted to store these reports in SharePoint because Dynamics 365 licenses are more expensive than the general Office 365 licenses, which SharePoint is a part of.

Visit Reports were created as an entity related to accounts in the Dynamics 365 system.

Steps performed:

  1. Set up Document Management sync between Dynamics 365 and SharePoint Online.
  2. Create a content type in SharePoint and associate a Word template with it.
  3. Go into Microsoft Flow and create a blank flow.
  4. Add a “trigger” from Dynamics 365 which will launch the flow whenever a record is created or updated in Visit Reports.
  5. Add an “action” from Dynamics 365 to get a record from the Account entity.
  6. Select the correct organization name (i.e. your company’s main tenant; ours is “MRS Company Limited”), select “Accounts”, and for the Item Identifier, we chose “Customer” from the list of dynamic content.
  7. Add an action to “Get file content” from SharePoint library Visit Report. This will be the blank template for Visit Report.
  8. Flow will prompt you for the site address and file identifier. Under site address, select/enter the URL for the SharePoint site. For File Identifier, select the template from the library location.
  9. Add another action step to create the file in the SharePoint library “Visit Reports”.
  10. Under site address, enter the URL for the document’s destination location in SharePoint. For the folder path, select the exact library. In this case, it is “/sti_visitreports”. For File Name, select Account Name from the Get Record step (see above) and Visit Date from the date the location was created/updated. For File Content, select File Content from the Get File Content step. See screenshot below:
  11. The final step is to add an action to update file properties. From here, select the URL and SharePoint document library, and then enter the ItemID from the Create File step. At this point, you can add in any metadata that is required via the dynamic content tab.
  12. Click save and start testing!