Skip to end of banner
Go to start of banner

sendEmail() Template Throws Error, "Variable >>issue<< is already defined in the same context!"

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

Problem

When referencing the “issue” variable in a template referenced when using sendEmail(), an error is thrown "Variable >>issue<< is already defined in the same context!"

The “issue” variable is a reserved keyword when using sendmail() with a template. Consider the following sendEmail() script that references “template.tpl”:

string issue = "DEMO-1";
sendEmail("name@example.com", "subject goes here, "path/to/template.tpl");

Now for template.tpl:

Current issue key: $issue$.

Solution

Consider using a variable besides “issue”. For example, “issueKey”:

string issueKey = "DEMO-1";
sendEmail("name@example.com", "subject goes here, "path/to/template.tpl");

Now for template.tpl:

Current issue key: $issueKey$.

In this instance, “issueKey” will not throw an error.

Filter by label

There are no items with the selected labels at this time.

  • No labels