Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to set a post function Component?

Fletcher Wu May 6, 2020

I'm using Set Field Value Post-function JMWE, and would like to set a Component post function after the ticket is created. My issue type is "Firefighter Ticket" and I'd like to add the component Firefighter after a Firefighter Ticket issue type is created. 

I set the conditional execution to "Only if condition is true" and the groovy script to 

issue.projectObject.name == "PROJECTNAME" && issue.issueType == "Firefighter Ticket" 

However when I try to test the validation via the Test Groovy Script button, it returns as false. What am I doing wrong?

1 answer

0 votes
David Fischer
Community Champion
May 6, 2020

It would actually be easier to use the Issue Fields help tab below the editor to figure out how to test these fields. 
in your case, the problem is that you want to test issue.issueType.name instead. 

Fletcher Wu May 7, 2020

Hi David

Thanks for your reply. I entered in issue.projectObject.name == "PROJECTNAME" && issue.issueType.name == "Firefighter Ticket"  however am still getting it returned as false

Is there something else I'm missing? Thanks for your help. 

David Fischer
Community Champion
May 7, 2020

You should test the script using the Test Groovy Script button, and if it returns false against an issue that is of the right issue type and in the right project, then you should test each part separately (project and issue type). And if one of them returns false, then test returning the value (without the comparison) to see what the _exact_ value is (case-sensitive).

Fletcher Wu May 7, 2020

Yeah that is what I've been doing. It returns false for this section

issue.issueType.name == "Firefighter Ticket"

That is the name of the ticket, so I'm not sure what I'm doing wrong. 

David Fischer
Community Champion
May 7, 2020

As I said, you can test issue.issueType.name to see what it returns. There might be an extra space, or a different in case. 

Suggest an answer

Log in or Sign up to answer