This article outlines how to set up a workflow that will generate a document which includes all child records that are related to a certain entity. Once the workflow is established, it will concatenate all these generated documents and send it to the account.
This feature is very useful if you, for example, would like to create a document that includes
- all quotes of a certain customer
- all contacts that are related to an account
- all invoices of a certain entity
In the now following step-by-step tutorial, we will create a document, that includes all contacts related to a certain account and concatenate it in one document.
Step 1: Create a new workflow for a random entity
If you have not created a workflow yet, please have a look at this blog article. In our example, we want to create a workflow for the entity account. Once the workflow is created, please add the DCPWorkflowSandobox:DCPCreateMultiPartXmlbassedonFetchxml step.
Figure 1: Workflow Activities
Step 2: Set the properties for the DCPWorkflowSandobox:DCPCreateMultiPartXmlbassedonFetchxml step
With a click on the [Set Properties]-button you add your individual properties to the parameters:
The first three properties allow you define the settings for the conversion of the documents to .pdf and for the general SharePoint information. The other properties are explained below.
Step 3: Create a FetchXML
We recommend you to use a FetchXML builder if you want to create a new FetchXML, because it facilitates the creation of a new FetchXML.
The FetchXML that is created for this workflow
- defines which documents should be filtered and concenated
- resolves the 1:N relationship
- enables you to add an unlimited amount of filters
Here is the FetchXML that was created for this example:
<fetch count="50" >
<entity name="contact" >
<attribute name="fullname" />
<link-entity name="account" from="accountid" to="parentcustomerid" link-type="inner" >
<filter name="account" from="accountid" to="parentcustomerid" >
<condition attribute="accountid" operator="eq" value="qid" />
Please note: It is of utmost importance that the qid (displayed above in red) is inserted, because the workflow activity will replace the qid with the accountid from the executed workflow. If qid is not inserted, the workflow cannot filter the results.
Figure 2: Set Custom Step Input Properties
Step 4: Create an AutoMergeWorkingItem
As next step you need to create the AutoMergeWorkingItem. Furthermore, the result XML from the CreateMultipartXMLbasedonFetchXML has to be added to the fieldMultiDocumentXML in the Advanced Section.
Figure 3: Set the MultiDocumentXML
The top of the AutoMergeWorking Item will look like below.
Step 5: Start your workflow
The result of your workflow will be visible in the CreatedDocument-field in the AutoMergeWorkingItems-window (please see figure 4).
Please note: You could as well combine this workflow with one that creates an eMail, attaches the here created document to an eMail and sends the so created eMail to a certain group of people. Please read more about how to create such a workflow here.
That's it! We appreciate your feedback! Please share your thoughts by sending an email to email@example.com!