Text templating and why you should use it

Hey guys,

So I just uploaded the first part of my project:

https://www.outsystems.com/forge/component-overview/5809/texttemplate

This component allows you to use text templating like liquid in ruby, twig in php or handlebars in js.
This specific component is build using a .net version of handlebars.js

So imagine, you created an email, but the users/client complain that they want some text changed.
So you change a little bit of text and you redeploy to test/production, until a few days later you again hear, they want some text changed!

This can become quite time consuming and frustrating for both you and the user.

So, how does templating solve this?
(I plan on creating a component so people can easily use this instead of building it themselves, the pattern should be the same).

What if the users themselves could create the template? Wouldn't that save you alot of time?
It sure would! But how will I get the variables and data in there without me still requiring to do some work?

Using text templates you can easily allow end users to use variables within the template, take a look:

This is an example email which I would like to send on {{CurrentDate}}.
I would also like to include something to present you with a login url.
<a href="mysite.com/loginpage?userid={{UserId}}">Login</a>

Now you as a developer can access this template by using a Template entity, which you can fetch on a name or static perhaps? You will have to discuss this with the person creating the templates though, since there's no way to fetch on a Id in your code (unless you use a static to determine the location of the template).

You can fill in this template with data using a record (or structure, or entity).
The attribute names of the record will be able to be used in the template (so be sure to communicate them to the person creating the templates!).

Let's say my record looks like:
Record.CurrentDate = 26-04-2019
Record.UserId = 26

You can then input the record to the component using ToObject(Record)

Which will create the following output:

This is an example email which I would like to send on 26-04-2019.
I would also like to include something to present you with a login url.
<a href="mysite.com/loginpage?userid=26">Login</a>

I hope you all find this useful and if not (or you think there can be some improvements), please let me know! I just created this because I couldn't find anything similar on the forge and I was in need of it myself.


Cheers.