JungleMail | Insert active content into email body using functions and formulas

It is not difficult to create an email template which has dynamic content. With JungleMail for SharePoint you can use formulas and functions to create such a template. This could be useful for your monthly email report, for example. In this way you can even make each of your sent emails unique for each recipient.  In this tutorial you will learn how to do this yourself with two examples.


Let's take a look at two examples which will illustrate how using functions and formulas can help you get more out of JungleMail.

Example 1

To calculate sold products we can use the Count and GetView functions. Format example: {Count(GetView("ListName"; "ViewName"))}

Note: If your List is not on the root (home) page, you need to provide a path to it. 

For example, if you want to count all items in the list view of "ProductA" in the "Licences" list which is on the "Sales" subsite, your function would be:

{Count(Getview("/Sales/Lists/Licenses/"; "ProductA"))}

We can show this value in percentages as well. All you need to do in this case is multiply by 100 and divide by the total number of items in the list ("AllItems" view). Your formula then, should look like this:

{Count(Getview("/Sales/Lists/Licenses/"; "ProductA")) *100/Count(GetView("/Sales/Lists/Licenses/"; "AllItems"))}

If you want more clarity and round numbers, you can round up your results to 2 digits. For this we add the  Round(number; digits) function:

{Round(Count(Getview("/Sales/Lists/Licenses/"; "ProductA"))*100/Count(GetView("/Sales/Lists/Licenses/"; "AllItems")); 2)}

And with the "%" sign at the end:

{Round(Count(Getview("/Sales/Lists/Licenses/"; "ProductA"))*100/Count(GetView("/Sales/Lists/Licenses/"; "AllItems")); 2)  & "%"}

The content of your email will look like this when you are editing it:

Click on Preview to check/approve your results.

Once configured, you can make this email job recurrent. An easy and precise way to monitor Sales performance every week!

Example 2

When you use the functions with additional parameters to filter the results, you can send calculated information to the right recipients at the same time as composing the email.

Note: Additional parameters in GetView() and FindItems() functions work only with equal conditions and when they are combined by operators. Supported additional unlimited parameters also work with additional date conditions (time is not included, only dates). You can learn more about formulas and functions in JungleDocs tutorials here. To execute formulas in JungleMail you should surround them with {} in your email body.

You can, for example, send details on issued invoices to all selected recipients. Every recipient then, will only get the information on the company they are working with at this time.

In the recipients list there is a lookup column "Company" and in Invoices library you'll find a lookup column "JDCustomer". Both columns take information from the Companies list. 

Using the  FindItems("ListName"; "ColumnName"; "ColumnValue") function we can take items only related to the particular column value ("ColumnValue") which is in the column ("ColumnName") in the list ("ListName").

JungleMail can mail merge columns inside function or formulas. So, in this example, we insert [Company], the mail merge placeholder as a column value, using this function: FindItems("/JDDemo/Invoices"; "JDCustomer"; [Company]). But we want to calculate the number of invoices issued to a particular company too. A complete formula will then look like this: {count(FindItems("/JDDemo/Invoices"; "JDCustomer"; [Company]))}

Next, we want to show the sum of all invoices issued to a particular company. For this, we use the function { Sum(arg1, "ColumnName")}. As the arg1 GetView() function and the column Subtotal Amount in Invoices list (JDSubtotalAmount) will be used we recommend using the internal column name, as it is not changeable.

Sum {[Company]} Invoices: {sum(GetView("/JDDemo/Invoices"; "AllItems"; "JDCustomer"; [Company]), "JDSubtotalAmount")}

To list the subtotal amounts of every invoice issued, you should, instead of sum(), use the JoinValues(arg1; "ColumnName"; "free text to separate values") function:

{JoinValues(GetView("/JDDemo/Invoices"; "AllItems"; "JDCustomer"; [Company]); "JDSubtotalAmount"; "; ")}.

The image below shows what the email content would look like:

And in the JungleMail Preview tab you can check to see if you are satisfied with the result.

Still need help? Contact Us Contact Us