Issue created notification we need custom field(priority)?

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

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.

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?)

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

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.

Hi Nic,

 

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

Please help me Nic,

 

Thanks 

Venkatesh

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.

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.

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

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

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.

 

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.

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 

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
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

23,716 views 2 7
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