I finally got the priority to update correctly in the cloned issues but now I am having trouble with the conditional parameters. I need the post function to evaluate the "Severity" field as Level 1, 2 or 3 and set the appropriate "Priority" in the cloned issue.
What happens is that no matter what the Severity is set to, 3 clones are created. How can I setup the post function to evaluate multiple conditions and do something based on the condition that matches?
I currently have 3 post functions setup. Can I combine these into one post function?
condition 1
issue.resolution?.name == 'Entered into Product Backlog'
cfValues['Severity'] = "Level 1/Critical"
action 1
issue.priorityId = '1'
condition 2
issue.resolution?.name == 'Entered into Product Backlog'
cfValues['Severity'] = "Level 2/Severe"
action 2
issue.priorityId = '3'
condition 3
issue.resolution?.name == 'Entered into Product Backlog'
cfValues['Severity'] = "Level 3/Important"
action 3
issue.priorityId = '4'
Thanks Jamie! I just had to make one small change to get it to work.
issue.resolution?.name == "Entered Into Product Backlog" && cfValues['Severity'].value == "Level 1/Critical"
You're still confusing = and ==. All your conditions are evaluating to true.
In your conditions you probably want == , ie test for equality.
In the action field you probably want =, ie assignment.
In the condition unless you are && or || ing the statements together all except the last one will be ignored. So it's really not clear to me what you are trying to do in your conditions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry. Thanks for the explanation regarding = and ==. I need 2 conditions to be met in order for the action to be performed. What I really need is to evaluate the issue for 3 sets of conditions then set the priority to one of 3 values based on the condition. e.g.
If
issue.resolution?.name == 'Entered into Product Backlog'
&
cfValues['Severity'] == "Level 1/Critical"
then
set issue.priorityId = '1'
else, If
issue.resolution?.name == 'Entered into Product Backlog'
&
cfValues['Severity'] = "Level 2/Severe"
then
set issue.priorityId = '3'
else, If
issue.resolution?.name == 'Entered into Product Backlog'
&
cfValues['Severity'] = "Level 3/Important"
then
set issue.priorityId = '4'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK... so just to take the first one only, the condition you want is:
issue.resolution?.name == 'Entered into Product Backlog' && cfValues['Severity'] == "Level 1/Critical"
You can do that with 3 separate post-functions as you are doing, or you can work out the priority in the additional code with similar code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie,
I'm having syntax trouble again. I need to add a condition to check for issue type = "New Feature" or issue type = "Improvement" and I can't get it right. I've tried issue.type?.name =="New Feature", issue.type?.value == "New Feature" , issue.typeid == 2 and a few others. Can you tell me what the correct syntax for this field is?
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
[ "New Feature", "Improvement"].contains(issue.issueTypeObject.name)
If you look at the javadoc for Issue you will find this...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@JamieA - I am having a similar issue with my If And Else Statement. Any ideas why this isn't working?
if (skillsetField == "Application Testing")
&& (getAction().id == "381")
{
BusImpactField.setRequired(true)
BusImpactField.setHidden(false)
BusImpactField.setHelpText ("Business Impact must be filled in once moved to 'Ready for Functional Testing'")
}
else {
BusImpactField.setRequired(false)
BusImpactField.setHidden(true)
BusImpactField.setHelpText ("")
BusImpactField.setFormValue(defaultValue)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.