It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Cannot fetch the changed values of a Custom field in the Email template

Sakshi Mittal Jan 05, 2016

Hi,

I want to add throw an email to a particular user when someone changes the custom field Business Priority(Customfield_11406). I can almost do it.

My problem is that I cant fetch the values of this custom field.

I want to display the old and new value of the Buisness priority Field. I read several posts but seems none works for me.

My condition is : changeItems.any {it.get('field')=='Business Priority'}

Email Template is: 

Summary = $issue.summary
Description: ${issue.description}
The priority of $issue.issueType.name $issue.key has been changedto $issue.getCustomFieldValue("customfield_11406") 

Old value :

Please review if necessary.

As soon as I add $issue.getCustomFieldValue("customfield_11406") , it throws an error saying  

No such property: getCustomFieldValue for class: com.atlassian.jira.issue.IssueImpl

2 answers

0 votes
Thanos Batagiannis [Adaptavist] Community Leader Jan 05, 2016

Hi Sakshi

Try to get the value of the custom field this way

<%
def subTaskCustomField = com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_11406")
def customFieldValue = issue.getCustomFieldValue(subTaskCustomField)
%>

Summary = $issue.summary
Description: ${issue.description}
The priority of $issue.issueType.name $issue.key has been changedto 
$customFieldValue

Please let me know if that helps

Kind regards

 

0 votes
Sakshi Mittal Jan 05, 2016

Yes Thanks Thanos. Its working. How can i get the previous value?\

Is there a way?

Thanos Batagiannis [Adaptavist] Community Leader Jan 05, 2016

Try to use the 'originalIssue', is type of Issue and represents the issue object before changes have been applied, on the other hand the 'issue' represents the current issue.

Sakshi Mittal Jan 06, 2016

Thanos, I tried but unfortunatley it is not working. I created another variable to capture the business priority of issue type original issue. My script is as below: <% def subTaskCustomField = com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_11406") def customFieldValue = issue.getCustomFieldValue(subTaskCustomField) %> <% def subTaskCustomField1 = com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_11406") def customFieldValue1 = originalIssue.getCustomFieldValue(subTaskCustomField1) %> Issue : $issue.key Summary : $issue.summary Description: ${issue.description} The priority of $issue.issueType.name $issue.key has been changed from '$customFieldValue1' to '$customFieldValue' by $currentUser. Please review if necessary. Regards Sakshi

Sakshi Mittal Jan 07, 2016

I have opened GRV-867 for this.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

682 views 7 0
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you