You are using an older browser that might negatively affect how this site is displayed. Please update to a modern browser to have a better experience. Sorry for the inconvenience!

Advanced Concepts of Draw Loop


By: Radha

In this article, we are going to see some advanced concepts of the Draw Loop with Salesforce integration.

  1. SOQL query in draw loop:

Generally, in draw loop we can merge the Salesforce record fields related to only the main object where we created DDP (Dynamic Document Package). To resolve this issue, we can use SOQL query in draw loop to fetch unrelated record or all child records.

Steps to create SOQL query: 

  1. Once the DDP record is created in Salesforce, click the ‘New Relationship’ button in the relationship section.

  1. Select Type as SOQL Query and write the SOQL query as to which record you want to fetch in SQOL field. Select Copy Type as row if you want to display list of records. Give any name to Relationship Alias to refer in field tagger.

  1. In Field tagger, we can refer the field which is returned by the SOQL query; so, click Field tagger in DDP record.

  1. Here, we can select the fields we want to merge in the document and place that tag to word document.

  1. To display records in table:
  2. Create a table in word document to display list of Salesforce record as shown below:
Name Type
<start><Name> <Type>

 

  1. Just two rows are enough to display all records dynamically based on the SOQL Query. One for displaying the title for the column and another for displaying records dynamically. In field tagger, there is a tag available as below. <<Parentguardians_Start>>, <<Parentguardians_name>>, <<Parentguardians_Type>>.
  2. These tags will have prefix with the field name we queried by SOQL. That prefix is taken from the name we used while creating the relationship record in the SOQL query in the field of Relationship Alias.
  3. The table size will be increased dynamically based on the number of records returned by the query. We don’t need to worry about the size of table.
  4. Dynamic image in word document:

We can display the Salesforce record image in a word document dynamically by using draw loop. The image should be public site URL in the Salesforce record field.

  1. Add a Rich Text field to an object
  1. Add an image to a record
  1. Configure the template
  1. Generate documents
  1. We need to create the rich text filed in Salesforce object to store the image in the record. After creating the field, add the image to the Salesforce record. In the Salesforce side, we have done the process to display the image. Now, we need to configure the template (Word Document) used in the draw loop to generate the dynamic document.
  1. Create the place holder in the word document to display the image and add sample image to the template. This image will be replaced by the Salesforce record image dynamically. The draw loop will automatically resize the place holder based on the image from the Salesforce record.

  1. In selection area, double-click the reference to the placeholder image, paste the tag from your clipboard, then edit the tag to include __image inside the angle brackets.

   For example 

Before

<<Account_Nintex_Image_Rich_text>>

After

<<Account_Nintex_Image_Rich_text__image>>

Conclusion: 

Using Draw Loop, we can use SOQL query to fetch all child records as well as un related records to display in word document dynamically. We can use a table to display list of Salesforce record in table and can display the image dynamically.

Reference Link: https://help.nintex.com/en-US/docgen/docservices/#docgen-sfdc/Services/templates/AddImagesRichTextField.htm