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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to reference a property in the last object in an array of objects with ConfiForms

I've got a ConfiForms form with a Jira issue field. The field is of the type Jira issue. By default comments for the issue are not available using the dot notation. I figured out that I can add comments into the object by adding in "comment" into the "Limit to these fields when fetching issues" box.

image.png

As an example, I can now access the comments like such ...

issueKey.fields.comment.comments[0].body

My question is this. How do I get the most recent comment? Using comments[0] will get me the first comment, but really I want the last comment. Anybody know how to do that? Is there a virtual function that I can use for this?

1 answer

1 accepted

1 vote
Answer accepted

Ok, I think I found out how to do it. After MUCH trial and error I had to do this ...

issueKey.fields.comment.comments.asJSON.get().body

Sorry for causing you troubles with the lack of documentation on this scenario.

I am surprised about the solution :-)

 

I think we need to add something like index=-1 and make something like this to work

issueKey.fields.comment.comments[-1].body

or support empty index 

issueKey.fields.comment.comments[].body

What do you think, @Davin Studer ?

Like Davin Studer likes this

@Alex Medved _ConfiForms_ Yeah, I think one of those would work. Maybe the first would be the best such that you could even do -2, -3, etc to get the second to last, third to last, and so forth.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

🤺 Atlympic Event: Partnerships

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

169 views 2 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you