Project ID in velocity template - how to?

Rumceisz March 13, 2014

Hi All,

we'd change the email templates: according to the project key, the users would get different links in the email notification hence we have 2 URLs accessing to JIRA.

The code snippet is the following:

#if( PROJECTKEY == "XY")
[ https://zzz.com/browse/${issue.getKey()}?page=${tabpanel-all}]
#else
[ ${baseurl}/browse/${issue.getKey()}?page=${tabpanel-all} ]
#end

Our problem is that we do not find the correct reference for the PROJECTKEY. We tried with this:

$project.Key() but it did not work.

Could you please help?

Thanks in advance,

Rumi

1 answer

1 vote
Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 13, 2014

Try $issue.projectObject.key or $issue.getProjectObject().getKey()

You may refer to this page for details https://developer.atlassian.com/display/JIRADEV/Velocity+Context+for+Email+Templates

Abhi Vaishnav
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 11, 2014

Yep, as Boris says looks like you can use $issue.getProjectObject().getKey().

However we use $issue.getProject().name for something similar that we do... but looking at the docs, our way might be deprecated and in need of an upgrade but it works for now.

Suggest an answer

Log in or Sign up to answer