Hi. I need to find specific objects in Insight (Assets) which contain a specific word in the comments. Is it possible to query the object comments, using IQL?
Need answer to this, please.
It is not possible to do IQL search which would filter objects based on comments.One can do it using groovy script, for example:
import com.atlassian.jira.component.ComponentAccessor// Define the comment keyword to search fordef commentKeyword = "test comment"// Initialize the ObjectFacade class to access commentsClass objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade")def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass)// Retrieve all comments for the current object using findCommentBeansdef comments = objectFacade.findCommentBeans(object.id as int) // Cast object.id to int if necessary// Check if any comment contains the target keyworddef hasTargetComment = comments.any { it.getComment().contains(commentKeyword) }if (hasTargetComment) {// Log the object ID and name to verify that we are targeting the correct objectlog.info("Found object with ID ${object.id} and name '${object.name}' containing the target comment.")}
It looks like you're new here. Sign in or register to get started.