• Documentation
  • Workato Blog
  • Product Blog
  • Return to Workato
  • Login
  • Automation Institute
  • Documentation
  • Community Forums
New Topic
Discussions Recipe Building Applications Questions

Benjamin Lee

started a topic over 1 year ago

[JIRA] Getting the "body" key from the last object in the Comments array

Hello, 


I am trying to use the app JIRA > Action: Get Issue Comments to get the last comment in a ticket. 


The data output I need gives me:

 

"comment" : {
    "comments": [
        {
            "body": "string"
        },
        {
            "body": "string"
        },
    ]
}

 


How can I get the "body" key from the last object?


I attempted to use the last() method which gives me the last object in the array, but I'm not able go further and get the Body. Any help is appreciated. Thanks!

Benjamin Lee

said over 1 year ago

I was able to resolve this. I was previously using 

  

[Step X: Comments].last().pluck('body') 

 

Which gave me the error: no implicit conversion of String into Integer


I just switched the methods around so that I'm plucking all the keys 'body' THEN getting the last value from the new array:


[Step X: Comments].pluck('body').last()

 

Hope this helps anyone that was also stuck with this issue.

Login to post a comment

Still can't find your solution?

Send us a ticket, we will try our best to assist you with your problem

Documentation
Developer's Library
Tutorials
eBooks
Product Hour
Product Blog
Workato Blog
Product updates
Customer Stories
© Workato 2022   Privacy   Terms   +1 (844) 469-6752
  • Documentation
  • Workato Blog
  • Product Blog
  • Solutions
  • Forums
  • Tickets
  • Log in
  • Return to Workato
Topic views count