Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,603
Community Members
 
Community Events
176
Community Groups

How to call a user function on parent issue in a Jira Structure formula?

Hello,

With Expert Jira structure language, I can write following code to check status of parent current issue:


if parent{status} = “Open”:
    …

Suppose now that the test is much more complex and I prefer writing a user function:

with cond = status = “Open” and … :

My problem is that I fail calling user function "cond" on parent issue ☹. Do I need to pass it as a parameter (how to do) or is it possible to call "cond" in parent issue context?

Thanks for your help.

LaBulle22

2 answers

1 accepted

0 votes
Answer accepted

Hello @LaBulle22 ,

Could you describe what you are trying to do, in full?  Understanding the use case will help in determining the best approach.

Best,
David

Hi @LaBulle22 ,

Thank you for the additional detail!

The format for creating a user function is described here.  Line 1 in the example is the format for the function and Line 2 is that function in use.

It's very similar to writing a local variable where you start the function with with and end it with :

Possibly what you were running into if you were trying to do PARENT{cond} is that local variables cannot be used within Aggregate Functions.  You would need to write the entire condition within PARENT{}.

If you're an Expr newbie, you may be interested in our Expr 2.0 Bootcamp Session I and Session II.  They are a great starting place!

Please let me know if this helps!

Best,
David

Hi David,

Thanks for all this information. I knew these 2 Bootcamp sessions that are a very good way to get started indeed.

OK, I understand one cannot use a local variable inside an aggregate function or pseudo aggregate function like "parent".

Seems there is neither no way to pass an issue as a parameter to a local function. We could imagine that following code could be possible after all ;-):

with get_summary(issue) = issue.summary:
get_summary(<something that returns parent issue>) 

But it seems that what I'd like to achieve is possible by using a Formula: say that Formula "KeyF" simply returns the issue key (or something much more complex). It's then possible to write:

parent{KeyF} or parent#level=-2{KeyF} 

to get the parent key or the grand-parent key of the current issue. Is that a normal use of Expr language or a dirty hack?

I've an additional question (that could maybe deserve a new thread, please tell me). Is there any technical articles that would go beyond the Formula & Expr reference manual and that would explain how all that works (high level view) and give some tips to the reader to optimize Formulas execution time (my current concern)?

Regards,
LaBulle22

Like David Niro _Tempo_ likes this

Hi @LaBulle22 ,

That would be normal use of Expr.  We have some documentation that describes Expr in some more detail here.

Please also feel free to contact our support team directly via support@almworks.com or through our customer portal support.almworks.com!

Best,
David

Hi David,

OK, I will contact ALM Support if need be. Thanks a lot for all the time you spent to help me  :-).

Regards,
LaBulle22

Like David Niro _Tempo_ likes this

You are very welcome @LaBulle22 !  I'm happy to help!!

Hi David,

In substance, I’d like to define a boolean user function (i.e. "with myuserfunction = ... :") that I could call either on parent issue or on grand-parent issue depending on the type of the current issue.

I could workaround my problem by writing parent{<attribute>} or parent#level=-2{<attribute>} depending of the type of the current issue but as the whole test is made of a combination several tests, I’d like to get a more elegant approach by writing code once and then call it either on parent or grand-parent.

I must say that I'm a "Expert coding language" newbie!

Regards,
LaBulle22

Suggest an answer

Log in or Sign up to answer