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

Next challenges

Recent achievements

Recognition

  • Give kudos
  • My kudos

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Davin Studer Community Leader Dec 27, 2019

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
Davin Studer Community Leader Dec 27, 2019

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
Davin Studer Community Leader Dec 27, 2019

@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

5 mobile apps for Jira Cloud to boost productivity

  It’s very important to have access to the workflow process from anywhere. Especially if you manage the work of others. There is no difference whether you’re out of office, or drive a ca...

284 views 2 5
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