---
title: "executeTemplate"
canonical: "https://support.appfire.com/space/PSCONF/15302915/executeTemplate"
format: markdown
---
> Macro (aura-html)

> Macro (table-plus)
> 
> |  |  |  |  |
> | --- | --- | --- | --- |
> | **Syntax** | executeTemplate(template_path[, charset] ) | **Package** |  |
> | **Alias** |  | **Pkg Usage** |  |

## Description

> Macro (excerpt)
> 
> Executes a template. All variables already defined in the script are passed to that template.

Executes a template. All variables already defined in the script are passed to that template. All variables already defined in the script are passed to that template. This routine obeys the context it is called. If you call it in an issue context, you can access issue fields in the template, if not you cannot.

## Parameters

> Macro (table-plus)
> 
> | Parameter name | Type | Required | Description |
> | --- | --- | --- | --- |
> | template_path | String | Yes | The template path, either absolute or relative. Note that if relative, this path is based on **KEPLER_HOME directory**, and not to the mail templates directory. |
> | charset | String | No | Specifies the charset used to read that template. |

## Return Type

**String**

## Examples

The template is represented below:

```javascript
$! if(isNotNull(baseVar)) { $
Well done, <strong>aseVar$ !
$! } else { $
Nobody to congratulate ?!? Whoaaaa !!!
$! } $
```

The script is represented below:

```javascript
string baseVar = "Monster";
return executeTemplate("templates/some.tpl"); //note that we refer this relative to Kepler Home directory !
```

The output produced is following:

```javascript
Well done, Monster!
```

## See also

> Macro (contentbylabel)