What is the purpose of local variable in Email Template?
In an Email Template, a local variable is used to hold temporary data that you need only while building that email content, and not outside of the email action/template scope. Variables in OutSystems
Once the email is generated and sent (the action finishes), all local variables are destroyed.
Some common reasons:
Formatting or combining data You might receive raw data in input parameters (like ManagerName, EmployeeName, etc.) and need to:
ManagerName
EmployeeName
You don’t want to change the original parameters; instead, you store the formatted result in a local variable and use it in the email body.
Intermediate calculations When you calculate something (like a status text, a URL with query string, or a greeting message), you store the result in a local variable to reuse it in multiple places in the email content.
Readability and reuse Complex expressions (e.g., several concatenations or conditional text) are easier to manage when you store them once in a local variable and then use that variable in the template.
From your image, your Email Template (or screen/block called Welcome) has:
Welcome
CompanyName
EmloyeeEmail
EmployeeDept
Var1
Imagine this is a Welcome Email to a new employee.
Create a local variable in the Email Template:
WelcomeMessage
Text
In the logic before rendering the email content (On Initialize / Preparation action of the email), do something like:
WelcomeMessage = "Dear " + EmployeeName + ",<br/><br/>" + "Welcome to " + CompanyName + "!<br/>" + "Your department: " + EmployeeDept + "<br/>" + "Your manager: " + ManagerName + "<br/><br/>" + "We have sent your login details to: " + EmloyeeEmail + "."
Now WelcomeMessage holds a fully formatted HTML/text block.
In the email body, instead of repeating the expression or concatenations, you simply use:
<span>{WelcomeMessage}</span>
Here:
After the email is sent, WelcomeMessage is discarded; it doesn’t exist outside the email action.
If you describe what you’re currently doing with Var1, I can suggest a more tailored example (e.g., building a redirect link, generating a token, etc.).
Thankyou For Sharing!