SharePoint Integration For Work Order - Part Two

Introduction


Recently, while working on the Field Service project, we got a requirement to set up SharePoint integration where a customer wanted to use the Folder stricture based on the Account entity. By default, an entity-based folder structure is not supported for work order entity so we used Flow to implement this requirement. This is my second article; please check the first article before reading this article.

Requirement

 
Implement Account entity folder structure for work order entity so that all the work order related documents are stored under the parent customer folder hierarchy. In an earlier article, we discussed how the document location record is created in Dynamics 365 CE when the folder structure is implemented using out of the box SharePoint integration. Now, let’s first create a variable to hold the folder path for the work order and Account. We can click on the "+ New Step" button to and search for a variable. We can set up a variable like the following.
 
SharePoint integration For Work Order
 
SharePoint integration For Work Order
 
On the above screenshot, we are using the same combination of work order number + GUID formula and Account Name + GUID formula that we used while creating a SharePoint folder in an earlier step.
 
Next, we are going to retrieve all the document location records based on the account. We can click on + New Step and can add List Record step and can configure it like following.
 
SharePoint integration For Work Order
 
After this, we need to process these records so we need to add Apply to each control and further, based on document location records, we need to check if Account folder exists already or not.
 
SharePoint integration For Work Order
 
Here we are checking the length of the result like the following,
 
SharePoint integration For Work Order
 
If a record is not present for the Account first we need to create a document location record for the Parent Account using SharePoint location record and then we need to create a work order Parent folder location record based on the SharePoint location record and finally we need to create a child work order record based on the work order path variable.
 
SharePoint integration For Work Order
 
SharePoint integration For Work Order
 
Once both the parent records are created we need to finally create a Child work order folder using the following configuration.
 
SharePoint integration For Work Order
 
And if a parent document location already exists for Account, we can only create a Parent Work order Folder and Child Work order folder using create record steps just like we did in the above step. We need to add these steps if there is no part condition. Click on Save and test your flow by creating a work order for the account and you will be able to see the work order created under the service account like the following,
 
SharePoint integration For Work Order
 
I hope it will help someone. Stay tuned for more Dynamics 365 CE Contents!!
 


Similar Articles
HIMBAP
We are expert in Microsoft Power Platform.