Different ways to Concatenate Strings in free Marker

We can achieve this by using + operator OR without operator Without + operator <#assign s = “Hello ${user}!”> ${s} Using + operator <#assign s = “Hello ” + user + “!”> Note : Assume that user is “Big Joe”. In both cases the output will be Hello Big Joe!

To remove all intervening line breaks in a template

Use <@compress single_line=true>…</@compress>  It aggressively removes indentations, empty lines and repeated spaces/tabs . Example: <@compress single_line=true> <#assign users = [{“name”:”Joe”, “hidden”:false}, {“name”:”James Bond”, “hidden”:true}, {“name”:”Julia”, “hidden”:false}]> List of users: <#list users as user> <#if !user.hidden> – ${user.name} </#if> </#list> That’s all. </#compress> OUTPUT List of users: – Joe – Julia That’s all.

Insert another FreeMarker template file into your template.

You can achieve this by using include. Syntax <#include path> or <#include path options> path: The path of the file to include; an expression that evaluates to a string. (With other words, it doesn’t have to be a fixed string, it can also be something like, for example, profile.baseDir + “/menu.ftl”.). Example: Assume /common/copyright.ftl contains: Copyright… Continue reading Insert another FreeMarker template file into your template.

Difference between ?? , has_content , if_exists in freemarker

?? tells if the left hand operand’s value is missing (means it’s null or undefined variable), and gives back false otherwise true (not missing) accordingly. ?has_content is very much like ??, except it also returns false for a 0-length string or empty array, etc.but It doesn’t return false for a 0, boolean false, etc. !… Continue reading Difference between ?? , has_content , if_exists in freemarker

Sent an email containing a bullet-point list

var listtodisplay = (function () {// listitems is an array of string to be listedvar string = “”;lisitems.forEach(function (item) {string += (‘<br>• ‘ + item.toString());});return string;})(); concatenate the above string listtodisplay to the Body of the email.

Script Sample to create a folder under a specified folder.

If you want to create a folder under a parent folder, you have to include N/Record module. Then create a record of type folder. Set the name to the folder. Set the parent of that folder. const createFolder = (name) => { let folder = record.create({ //creating a folder type: record.Type.FOLDER, isDynamic: true, }); folder.setValue(“name”,… Continue reading Script Sample to create a folder under a specified folder.

Delete Files from File Cabinet using Mass Update.

Delete Files from File Cabinet using Mass Update. Navigation Lists>Mass update>choose files>delete file. Delete Files from File Cabinet using Mass Update. Enter the Search criteria to get all files to be deleted. Click on Preview to check the files going to be deleted. Click the checkbox under Apply if you don’t want to consider that… Continue reading Delete Files from File Cabinet using Mass Update.