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,559,883
Community Members
 
Community Events
185
Community Groups

Get comments from Insight object using SIL

Hello everyone,
I would like to extract comments from the Insight object using SIL script.
Unfortunately, there is no way to access comments in the Insight-connector routines (https://anovaapps.atlassian.net/wiki/spaces/PSJ/pages/1153138814/SIL+Insight+Routines).
I had an idea to create an object attribute that would be a list of comments, but this is also not possible.
How do I do this?

1 answer

1 accepted

1 vote
Answer accepted
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 02, 2023

You might need to extend your SIL using the SIL Groovy Connector.

Then use the native JAVA API to fetch the comments.

Here is an example of how the SIL Groovy Connector can call a groovy script.

https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15488333/Passing+Values+Between+SIL+and+Groovy

Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 02, 2023

Here is a sample groovy script to return all the comments from an object given its key:

 

import com.atlassian.jira.component.ComponentAccessor

def objectKey = "{{objectKey}}"
def classLoader = ComponentAccessor.pluginAccessor.classLoader
def ObjectFacadeClass = classLoader.findClass('com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade')
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(ObjectFacadeClass)
def object = objectFacade.loadObjectBean(objectKey)
def comments = objectFacade.findCommentBeans(object.id)
comments*.comment

Use the method mentioned above to replace {{objectKey}} with the actual key of the object.

I'm more of a groovy/scriptrunner person myself. So I'm not familiar with SIL and how you might be able to grab additional content from each comment or how you might pass a more complex structure from the groovy script to the SIL engine.

I love you man, it works!!
Can you provide useful documentations on your opinion to understand code above

Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 03, 2023

The starting point for using groovy with Insight is the 

Assets app development > Groovy scripting page

And how each Insight/Asset classes might be used can be found in the JavaDocs

For example, here is the JavaDoc for ObjectFacade and the Javadoc for ComentBean.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events