To complete our scenario from the previous blog post, we have to create Flow number 2:
On status change of the lead: if qualified, then set the regarding field at the document location record to the qualifying opportunity.
Here is the overview of the Flow:
When a Lead is qualified, the Qualifying Opportunity field is populated, so we use this field as Attribute Filter in the trigger When a record is updated.
Then we get a list of Document Locations regarding the qualified lead that have the Sales Number of the lead as Relative URL. For every Document Location the Regarding field is updated with the Qualifying Opportunity and Regarding Type field to ‘opportunities’.
Now when the lead is qualified and we open the related Documents at the qualifying opportunity, the sales documents of this sales are available.
I did it my way, you can do it your way. It’s just to show that you can introduce your own logic to the creation/integration of SharePoint Document Locations, so you don’t have to accept the funny folder names and “logical structure” of the standard integration.
On Lead qualification the Document Location is created for the Qualifying Opportunity by the system itself so it seems, and there is no need for the Flow to do the same 😉
Reference on Microsoft Docs: QualifyLeadRequest > Remarks > Notes for Callers
If SharePoint integration is enabled, the document location records for the lead are copied for the newly created account, contact, and opportunity.
The user that is qualifying the Lead needs the Create privilege on Document Location or else the following error will occur: