How can I display a message with the first user in a project role ?

I'd like to display a message, indicating (This will be automatically assigned to Project role DEFAULT_BAL (=userx)). I need to extract a user from a project role from an issue. My groovy script is ok.

I've tried to insert thisgroovy script in velocity, but in velocity this line gives an error ....ProjectRoleManager.class

Any idea ?


<FONT color="blue" style="BACKGROUND-COLOR: yellow">Infobox2</FONT>
<FONT color="green">
#set($issueid = ${issue.getKey()})
#set ($thisType = $issue.getIssueType().getString("name"))
#set ($name = $authcontext.user.getFullName())
#set ($resolution = $issue.getResolutionObject().name)
#set ($status = $issue.getStatusObject().name)

## project
#set ($proj = $issue.getProjectObject())

#set ($componentManager = $ComponentManager.getInstance())
#set ($projectManager = $componentManager.getProjectManager())
#set ($projectRoleManager = $ComponentManager.getComponentInstanceOfType(ProjectRoleManager.class))

## role
#set ($pjrole = 'Default-BAL')
#set ($devsRole = $projectRoleManager.getProjectRole($pjrole))
#set ($actors = $projectRoleManager.getProjectRoleActors($devsRole, $proj))

<li>pjrole = $pjrole</li>
<li>actors = $actors.getUsers()</li>
<li>actors = $actors.getUsers().size()</li>

<li> $proj.key - $ - $proj.lead - ${proj.getId()} - $proj.getKey() - ${proj.getName()}</li>

<li>Key = ${issue.getKey()} - $issueid</li>

<li>userid = $issue.assigneeUser - username = $name </li>
<li>Type = $thisType - resolution = $resolution - status = $status</li>
<li>Assignee = $issue.getAssigneeUser() - reporter = $issue.getReporterUser()</li>
<li>Env = $issue.getCustomFieldValue($customFieldManager.getCustomFieldObjectByName("Environment"))</li>
<li>Field4 = $issue.getCustomFieldValue($customFieldManager.getCustomFieldObjectByName("Field4"))</li>


3 answers

1 accepted

I leave velocity.

0 votes

Where are you inserting this? BTW this is not groovy, it's velocity. Are you using the velocity-processed custom field?

Exactly this is the conversion (adding #set ....) groovy to velocity for a "velocity-processed custom field (edit).

The result is there (in green):

A lot of fields are correctly extracted and displayed, but not the first project role user.

  • pjrole = Default-BAL
  • actors = $actors.getUsers()
  • actors = $actors.getUsers().size()
  • TIBCO - Tibco - FAB055 - 10130 - TIBCO - Tibco
  • Key = TIBCO-170 - TIBCO-170
  • userid = FAB055 - username = Katz Michel
  • Type = Support - resolution = $resolution - status = Open
  • Assignee = FAB055 - reporter = FAB055
  • Env = [Production]
  • <font></font>
  • Field4 = $issue.getCustomFieldValue($customFieldManager.getCustomFieldObjectByName("Field4"))
  • <font></font>

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,167 views 13 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot