Hello, we are evaluating Insight. I have database background and I used DataStage before this.
I am surprised that while importing data I only can pick existing fields from drop down menu, and no functions, even the simplest ones.
I need the following
1. constant text field - that has the same contents for all rows
2. metadata of csv file (name, date of cretion etc)
3. lookup - to be able to use lookup table
Hello!
I'm sorry but I really need more specific answer, that those links don't provide. What are those minor changes? How I provide default value? How I execute groovy script?
I only want to add a constant value to an attribute, that is a trivial task, I suppose that is not that much complicated that it couldn't be explained?
with regards
Sanja
Hi Sanja!
To add an default value to an object, you need to create an automation rule, that sets the default value when an object is created.
For that, you use an groovy script.
What you need to change in the groovy script that is attached, is the name of the attribute (also mentioned in a comment in the script), and the value that you want (also mentioned in the groovy scripts), that is all the changes needed.
In the automation documentation, there is a section called Execute Groovy Script, there you can read what is needed to trigger the groovy script.
Basically to create the rule, make sure to set WHEN to trigger on object creation.
If needed, you can set IF to filter on IQL, so that only specified object types are used, if the rule should not apply to all object types.
You can limit the search result on object typ ids like objectTypeId in (1, 2)
Then should be set to use the groovy script you created, and that is basically all that is needed.
I hope that helps you to get closer to a solution that could be used :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I give up on this,
I don't have enough information. Documentation available is in need of a major update in order to be usefull. It should be rewriten so that the reader can understand what is the point. There is some info available, but the context is missing - what. where. why.
In absence of documentation I need specific instructions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sanja,
Lets say that you have an object type called Person, with an attribute of type text Called Option.
Now when an person is created, you want to set Option to the value "Object is created". Then the groovy script would look like this:'
import com.atlassian.jira.component.ComponentAccessor;
Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade");
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass);
/* Get Insight Object Attribute Facade from plugin accessor */
Class objectTypeAttributeFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeAttributeFacade");
def objectTypeAttributeFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectTypeAttributeFacadeClass);
def obTriage = objectFacade.loadObjectAttributeBean(object.getId(), "Option").createMutable() // The name of the attribute
def value = obTriage.getObjectAttributeValueBeans()
def valueBean = obTriage.createObjectAttributeValueBean()
valueBean.setValue(objectTypeAttributeFacade.loadObjectTypeAttributeBean(obTriage.getObjectTypeAttributeId()), "Object is created") //the default value to set
value.clear()
value.add(valueBean);
obTriage.setObjectAttributeValueBeans(value)
/* Store the object attribute into Insight. */
try {
obTriage = objectFacade.storeObjectAttributeBean(obTriage);
} catch (Exception vie) {
log.warn("Could not update object attribute due to validation exception:" + vie.getMessage());
}
For the WHEN section of the automation rule, it should use the event object created, and the IQL would be set to objecttype = Person
And the IF section can be left empty as you already have provided IQL, and on the last section (THEN), you would trigger an groovy script, and add the URL to where this groovy scripts is that you created.
I hope that gives you more information. And as mentioned, perhaps it's possible further ahead to involve a partner that can help with the configuration, but I hope this example will help you further.
Best Regards
Alexander
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for showing me how it is done! Now I have clearer picture. We try to avoid scripts as policy, since they are pain to support - but I can try to see how this works.
As I previously mentioned I am importing servers from several different files, so the constant is constant only for that import, and not for each update.
I tried to work around this problem by enabling parent inheritance and having several imports, each to its own child. That resulted in multiple Names. I expected that Name (the label) is unique for any object type - including the parent with inheritance switched on. But it isn't. Am I missing something?
Best regards
Sanja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sanja,
Sorry for the late response.
It's not possible to add some constant for imports, like setting that a specific attribute should get an default value. This can however be done using automation, so that each time an object gets created / updated, you could set an value by default. More information on that can be found at
Could you please describe the use case for point two and three and what the requirement would be?
Best Regards
Alexander
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I wrote the huge detaild answer and since it was too long, the cursor slipped into another window, I tried to scroll and get back into it, but it is all gone!
This editor is not working properly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am already reading and re reading those but the learning curve is too steep. I am of database and Data Stage background.
1. I am importing servers from several different files, so the constant is constant only for that import, and not for each update.
2. Metadata are for example, name of file, path, date of creation, creator etc. How to import that?
3. I have official list of application and I import it into Application and it works fine. I have supplemental file that is SCCM scan of all running applications. I want to lookup official list and if the name of application is not there, do nothing. If it is there, update.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also, under "Update an Object Attribute" there is a screen of code. How it is used in order to add custom field? In automation, but where?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sanja,
What I would recommend is to get in contact with one of our partners, from https://riada.se/partners/
They can help you both with configuration and setup, creating groovy scripts etc.
It's currently not possible to import the meta data from the CSV file. Where would you want that information stored, on each object imported?
It's not possible to run an import and only update objects, if what is used as an identifier is not matching any object in Insight a new one will be created. We have received similar request and feature request can be added at jira.riada.se and you could check if possible a feature request like this has already been added and watch that ticket for any updates.
If you look at the documentation for automation, you'll see that there is an option to execute groovy scripts. I would execute an groovy script where i set an attribute to a default value, based on object creation and if the object is of the correct object type using IQL to filter it out.
You can read about IQL at https://documentation.riada.se/insight/latest/insight-user-s-guide/iql-insight-query-language
Best Regards
Alexander
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alexander,
Service Desk is going into production so all support form Jira partner is allocated to that for the time being. Decision where to allocate support is not mine.
My role is to evaluate Insight and I am on my own.
As I said, I am reading the documentation for automation. trying to find a way how to do things that I need, but documentation is not helping. When I read it it feels like a big part is missing to be able to connect the dots.
Please can you explain what you mean by "I would execute an groovy script where i set an attribute to a default value, based on object creation and if the object is of the correct object type using IQL to filter it out."
Thank you very much
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
I a referring to Automation, as documented at https://documentation.riada.se/insight/latest/insight-manager-s-guide/insight-automation
Where one of the options is to execute a groovy script.
We have one that could be used for this where you would need to do some minor changes: https://documentation.riada.se/insight/latest/insight-for-developers/groovy-scripting/groovy-script-examples/automation/update-an-object-attribute
Using this, you could create an automation that triggers whenever an object is created, and you could make sure that you set an attribute to a default value that you provide in the groovy script.
Best Regards
Alexander
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.