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,560,301
Community Members
 
Community Events
185
Community Groups

Search and remove multiple records from Insight CMDB automatically

Hi all,

We use Insight with a CMDB. We would like to search and remove a list of records. The key to search for is "registration number".

The idea is to loop through a list of registration numbers and if found delete the record.

I have no experience with scripting and new to Insight. Hope there is anyone with some tips.

 

 

2 answers

1 accepted

0 votes
Answer accepted

I solved it, very very easy

"Registrationnumber" IN ("<number>","<number>")

1 vote
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.
Jan 05, 2022

Is this a one-time thing? Or some automation that you want to happen at some regular interval?

Can't you just use IQL to search for matching records and then manually invoke the bulk delete feature?

If you want something regular, you can use the built-in automation feature with a scheduled trigger (with IQL) and delete object action.

Hi Peter-Dave. It needs to run at a regular interval.

With built-in automation you mean in Jira or does Insight has its own automation?

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.
Jan 05, 2022

Insight has its own automation. But looking more carefully, I see that it's missing a built-in action to delete. But you can create an automation event with a short delete script.

Create a script file in your jira installation file system. A suggested path is <jira-home>/scripts.

Eg. <jira-home>/scripts/insight_automation/deleteObject.groovy

The file should be readable by jira.

Add these lines to the file:

import com.atlassian.jira.component.ComponentAccessor
import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(ObjectFacade)
objectFacade.deleteObjectBean(object.id)

 

Add the script file to the insight whitelist: <yoursite>/secure/admin/InsightPluginWhiteList.jspa

Create an Insight automation:

Look under the Object Schema configuration. There is an Automation tab.

  1. Create a new Rule
  2. Give it a name
  3. Set the "run as" user to a service or admin account with delete permissions
  4. Add a trigger
    • Event Trigger = Scheduled Event
    • Condition=Enter the IQL that returns records that you want to delete regularly
    • Cron Expression = set the interval
  5. Add an action
    1. Action=Execute Groovy Script
    2. File Path = /path/to/your/script.groovy

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events