In Flexie CRM, a core part of it, is the Templates section, which you can use to create reusable content for your emails, notes and everything else related to content you distribute or generic use within your CRM.

Templates have the capability to parse the Flexie Scripting language, which is a very handy tool to compose highly dynamic content. In the Templates section there are 2 type of templates, the Note Template, and the Email Template, both of them have the same capabilities in terms of content parsing and handling.

A very important part of Email and Note templates are the Snippets, which is a small reusable part of content, which may be included in both email and note templates. Snippets are very useful for organizing your template content, because you might have small pieces of information used everywhere so you won’t want to duplicate your content and moreover you won’t want to do changes in all templates if something small has the need to be changed. For instance your signature, you have it in almost any template, so you can add a snippet for handling your signature only, which might be used in 100+ templates… See, how handy and practical it is?

Here it comes the scripting needs… imagine what’s a CRM all about if everything could not be dynamic! So with that being said, the scripting is a must in the nowadays.

We will explain the Scripting by parts, so first part is the capability you have to parse dynamic variables in your templates. What does this mean?

Dynamic variables are data records from your entities you use to write personalized emails or dynamic notes and a lot more, but lets take the email example. When you create a new Email Template you are asked to choose the entity this email template belongs to, so let say you would choose Leads. This mean that, any lead you going to send this email template, you can parse lead data within the template.

Hey {{first_name}},

there was a pleasure to talk to you today
. . .

Kind Regards,
{{owner_id.first_name}}

So notice this sample email template, the parts within {{ and }} are the dynamic variables, in this case the first_name is the lead field with the alias as first_name, so the parsed wordings would be “Hey Marc, … ” because the word Marc, is on that record you are sending the email.

Within the template, you can parse dynamic variables, use IF/ELSE statements, call built-in methods or include snippets.

How all this can be done? Well, we gone get one by one illustrated with real cases examples, without doing boring theoretical explanation.

Parsing and Setting a Variable

A variable is always parsed using {{ … }}, so double bracket, but you can also set a variable and do manipulation on it.

Notice above that we used the random method, which is a build-in method and returns a random value. So it gets as an argument a collection of values, which can be static words like in the example or variables, but in the variable case the single quote is not needed.

Using IF/ELSE statements

You can use conditional statements within your template, so you can create conditional values for any scenario.

As you can see the IF/ESLE statement its pretty straightforward and simple to understand, also the “status” word in there, refers to a variable, and its exactly the status field of the entity, and what the block of this statement does, it checks if the status of the Lead is New, then it parse a different message based on that condition.

Looping through records

Let say you have the contacts entity, which has a children entity of subscribed events, so you may want to email them and remind about all upcoming events, so what you may need to do is to use the built-in method findMany, and filter the subscribed events belonging to the contact you are emailing. In this way you can loop through those records.

It’s pretty clear and self explanatory, we get all events which belongs to the contact, loop through them and parse the fields we are interested in, this way we are creating a template by parsing dynamic variables, getting additional data, looping through them, and also parsing dynamic variables within the loop itself.

The built-in methods

In Flexie CRM, there are some pre-built methods which can be used, and cover almost any scenario you may have. We will list here for you reference so you can tell which one does what.

To stay updated with the latest features, news and how-to articles and videos, please join our group on Facebook, Flexie CRM Academy.