How do you determine the available valid conditions for a post-function condition?

Tony September 29, 2011

I have a post-function function that depends on a value of a field of an issue. How do I get a list of the possible. valid values that can be conditionally tested? For example, I need the correct syntax to test the project key. Where do you find the correct syntax for the variable to be tested (e.g. issue.projectkey.name == 'ABC')?

Looking for a list or where to view code like 'issue.projectkey.name'.

Cheers!

3 answers

1 accepted

0 votes
Answer accepted
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 29, 2011

Hi,

Your code looks like groovy. If you could tell us the name for the post-function we could be sure. Assuming it is groovy then it would be:

issue.projectObject.name == "ABC"

On the more general subject of "how", my advice is at this answer.

Also explained in that is how project/projectObject are methods.

Tony September 29, 2011

Yes, it is Groovy that I am using. And yes this did do the trick. Thx

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 29, 2011

Oh, I see you asked that other question too. I guess my advice was not helpful :-(

Tony September 29, 2011

Your advice is always helpful.

Just trying to get a better handle on creating a debug/test enironment for jira so I can step through the code and see this all for myself.

I looked at MutableIssue and see the methods for the class issue. But still not comfortable with how you got the

.projectObject.name

since I do not see that anywhere on the MutableIssue link?

Cheers!

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 29, 2011

OK so... issue.projectObject.name is the same as issue.getProjectObject().getName() in java...

getProjectObject() is on MutableIssue (see javadoc link) but it's inherited from Issue.

getName() is a method of Project (which is what is returned by getProjectObject()/projectObject).

cheers, jamie

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.
September 29, 2011

That's quite difficult to answer because we can't be sure what objects you've got, and your language doesn't look like Java (which is all I'm familiar with writing in plugins)

However, the most obvious case for a post-function (and what I'd do) is that your "issue" is a "MutableIssue" object, or possibly just an "Issue" (in either case getting data out of them is the same) - see http://docs.atlassian.com/software/jira/docs/api/latest/com/atlassian/jira/issue/Issue.html for the details of why you probably want:

issue.getProjectObject().getKey() will give you a raw string of ABC. Of course, in Java, you probably want to use .equals rather than == as well.

Tony September 29, 2011

I was looking for the syntax for the condition in the post-function of a workflow. At that point the issue values are already available within jira in the MutableIssue object. Just need to know the variable and syntax to use in the condition.

Can't determine if it is issue.project.key == 'ABC' or issue.key == 'ABC' or whatever.

Do you know where that information is stored? The MutableIssue link gives me the methods but not the object variables.

Thanks for your prompt response -- I appreciate you help.

Cheers!

0 votes
Tony September 29, 2011

Just to elaborate, I am trying to determine how to set the condition on a post-function function. Using the example above -- project key -- would the proper condition syntax be:

isssue.projectKey.name == 'ABC'

or

issue.key == 'ABC'

or

issue.projectKey == 'ABC'

How can one see which is the proper syntax for the condition?

Cheers!

Suggest an answer

Log in or Sign up to answer