Issue created notification we need custom field(priority)?

Pokala Venkatesh July 11, 2017

Hi Team,

    This is an urgent request and please help me ASAP

 

Whenever issue created notification is recieved with fields(reporter, creator). But our project is using custom field priority. We want that priority field in notification.

 

Thanks,

Venkatesh.

1 answer

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 12, 2017
Pokala Venkatesh July 12, 2017

Hi Nic,

   Thanks for update. As per the provided document have edited template file. But still i'm not fix this. Please help me on this i am not much aware of those templates codes.

Added code: #if ($issue.getCustomFieldValue("customfield_10000"))
$stringUtils.leftPad($issue.getCustomField("customfield_10000").name, $padSize): $issue.getCustomFieldValue("customfield_10000")
#end

paths: atlassian-jira/WEB-INF/classes/templates/email/text/issuecreated.vm
atlassian-jira/WEB-INF/classes/templates/email/text/includes/issuesummary.vm

 

Thanks,

Venkatesh.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 12, 2017

I very much doubt your custom priority field is id 10000 - you need to re-read the doc and use the right one.  The code you've copied and pasted also assumes the field is a string, which it may not be.

Also try debug code - add <p>My debug</p> just above the "if" lilne, and make sure that appears in the email - if it does not, then you know you've not got the code in the right place (wrong template adjusted?)

Pokala Venkatesh July 12, 2017

Hi Nic,

 

    Thanks for your help! I just copied documented code but actually i replaced my custom field ID. Let me try what you suggested the code <p>My debug</p>. 

 

Thanks,

Venkatesh

Pokala Venkatesh July 13, 2017

Hi Nic,

 

    I have added <p>My debug</p> infront of #if. But still i am unable to get output. I have attached what i did please check and let me know.

path.pngCode.pngOutput.png

Thanks,

Venkatesh.

Pokala Venkatesh July 18, 2017

Hi Nic,

 

     Followed provided documentation but still facing problem. Please provide cleared steps?

Please help me Nic,

 

Thanks 

Venkatesh

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 18, 2017

The error in there tells me the velocity you have written is not right - have a look in the file you've edited for the lines it's complaining about.

Pokala Venkatesh July 19, 2017

Hi Nic,

  Sorry for the distrubing. Can you please share the details what i need to put(code) where i need to place ?

 

Thanks for your help!

Venkatesh Pokala.

Pokala Venkatesh July 19, 2017

Hi Nic,

   This is a high priority ticket for us. Please provide the code and path and full details of this. Thanks for your great help!

 

Thanks

Pokala Venkatesh July 19, 2017

Hi Nic,

   I think you know cleared steps on this. If you don't mine please give me some time and share the available timings then we will discuss on call 10-15min. What's your suggestion?

 

Thanks

Pokala Venkatesh July 19, 2017

Hi Nic,

 

I have now added the code in correct path. Here i am observing some issues with that.

1. It is effecting all the projects issue created notifications. Here the custom field is associated with some of the projects only. But when we creating other projects issue/ticket custom field is appeared in notification. Here we need only for custom field related project issue created notification.

2. But here custom field priority is appeared  in out of the box.Please check the screenshot and let me know.

Notrelated.pngRelatedscreenshot.png

Regards,
Venkatesh.

 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 19, 2017

Ok, you're getting close.

On the first screenshot, you have highlighted the system Priority field - that will appear if it is set, even if you have removed it from screens so users don't set it.  Your second screenshot shows an issue where it has not been set.  If you want, you can surround that with an "if" to hide it.

Both show your custom priority coming out, which is good because you've shown you can get it and display it.  But obviously, it's in the wrong place.

You need to move it up the template to the right place.

Finally, yes, you can get rid of it for certain projects.  I don't know that this is the right call, but something like:

#if ( $issue.getProjectObject().getName = "My Project" )

Wrapped around it should show/hide it.

Pokala Venkatesh July 20, 2017

Hi Nic,

 

     Thanks for your help!  I just moved the code to top but still same result and as per your advised i have added the code {#if ( $issue.getProjectObject().getName = "My Project" )}.  I just replaced the My Project with my existing project and one more thing as per my request some of the projects using system field(Priority) and remaining projects using customfield name priority. Here we create the custom fields project issue we need the priority in notification. If we create the system's fields priorities projects we need system priority don't want customfield. But our output is both fields is coming in notifications. Please please help me

 

Thanks 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 20, 2017

You need to look again at the template - it renders html by reading from top to bottom and interpreting the code in there.

Moving your priority code to the top was not going to help - you need to move it inside the sections/div/table or whatever it is using to structure the output.

I think what you want to do is :

Find the line that produces the system priority in the file.

It will say something like the below (I'm working from an old memory here, so this is just pseudo-code, not real code)

$stringUtils.makeNice( $issue.getPriority )

Wrap both of your bits of code around it, so you get:

#if ( $issue.getProjectObject().getName = "My Project" )

  <your priority>

#else

  $stringUtils.makeNice( $issue.getPriority )

#end

Suggest an answer

Log in or Sign up to answer