You are viewing limited content. For full access, please sign in.

Question

Question

Forms email format- working with collection variables

asked on November 16, 2020

How can I format the approval email in LF Forms to display each invoice info separately? The current setup is using a collection, 1- 10 invoices can be submitted. So if I select the collections field variable in the email body, it will display all invoices info together, only separated by a semi-colon. 

For example, these 2 fields in the email body:

Vendor Name: {/dataset/AP/Vendor_Name_}

Invoice #: {/dataset/AP/Vendor_Invoice___}

 

Translate to:

Vendor Name: Invoice1; Invoice2; Invoice3 

Invoice #: 1234; 4321; 1342

 

How can I format it to do this:

Vendor Name: Invoice1

Invoice #: 1234

 

Vendor Name: Invoice2

Invoice #: 4321

 

Vendor Name: Invoice3

Invoice #: 1342

 

0 0

Replies

replied on November 16, 2020

Hi Jorge,

You can directly get each value with help of index , e.g. {/dataset/AP/Vendor_Name_[1]} (1-based indexing).

While it may not work as perfect when the count of collection sets varies. In that case, the alternative is to use a hidden field filled by JavaScript, where the value is split and format as desired. Then use the field value in email template.

0 0
replied on November 17, 2020

In my opinion I'd go the Workflow route to email the data.

Save the data like this: 

Vendor Name: Invoice1; Invoice2; Invoice3 

Invoice #: 1234; 4321; 1342

Then retrieve the field values or the BP values directly from Forms, however you find more suitable.

Then in Workflow simply create a new token like so:

Then in the assign token values right click and go to Token Editor:

Then click Apply Function -> Select a Function -> Find "Split" on the list:

Then below where it says "Split On" -> Type a semi-colon ";"

The result:

Now you have leading spaces. To remove them apply another function called "Trim" the same way you added split.

Then your new result: 

Now email this via Workflow.

Cheers.

0 0
replied on November 17, 2020

Tokens generated by Retrieve Business Process Variables for fields in a table or collection are already multi-value. So you can format them directly without assigning them to a new token and splitting the values out.

0 0
replied on July 1, 2022

I need a solution with out the workflow. I have exactly the same situation as above. Please help.

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.