Hi everyone,
In my insight object schema I need that when upgrade a value in father object this particular attibutes change also in child object
Thx for ur time
Best Regards
Hi,
Can you elaborate on how you see the father - child concept in Insight? Because inheritance attributes and father - child objects are 2 different concepts.
Perhaps a clear example?
Regards,
Jeroen
Hi Jeroen,
Thx for your help, how can you see in the picture we have "clienti" as father and "desktop" as child. Bouth have an attribute called "uo_loc" that is the campany location.
For example if we have Paul (ot "clienti"),and actually have one desktop (child object) and Paul change location when I§ enter in edit to change Paul's location I want automatically upgrade also in desktop location
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok almost there,
Do I understand it correctly that you have Paul linked on the Desktop object?
While you can use inheritance in this way, I think the idea is to use like this for example:
In this setup you would probably have common attribute like a Name and Weight for example on the parent where you would have a non-inheritance attribute on OT Cat let's say ... "Number of mice caught" :-).
That aside, my first question here remains. Do you also have Scriptrunner in your instance?
Regards,
Jeroen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
unfortunately no we dont have it but i can ask for buy it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Native it's not possible, but with scriptrunner it will be
Regards,
Jeroen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jeroen,
thanks for your answer, I understand that is not possibile do it without SR, can u plaease give me an example using a script?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Davide,
Not ignoring your question, just need to see if I have something like that on the shelf :-).
Regards,
Jeroen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hoi @Jeroen Poismans ,
als je hiervoor een voorbeeld-Scriptrunner script hebt ben ik daar nieuwsgierig naar. Ik heb bij een klant van ons namelijk een bijna identieke usecase en daar is wel Scriptrunner geïnstalleerd.
if you have an example Scriptrunner script for this I am curious about it. I have an almost identical use case at one of our customers and Scriptrunner is installed there.
Thanks in advance and greetings from the Netherlands.
Marco
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you post a screenshot (or some) to clearly see the hierarchy of the objecttypes? Because in an earlier reply you spoke of a picture, but it was not added.
Regards,
Jeroen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Davide Cascapera , @Marco Brundel ,
In meantime, I have found a script which is similar and should be a good starting point to get you where you want. Don't be alarmed by the length, most of it are auxiliary functions to do CRUD on Insight objects.
What you have to do in advance:
On top of the script are some variables to supply:
int OBJSCHEMA_ID = 000
int CLIENTI_OBJTYPE_ID = 000
String PARENT_OT = "clienti"
String UO_LOC_ATTR_ID = 000
The script:
import com.atlassian.jira.component.ComponentAccessor
int OBJSCHEMA_ID = 000
int CLIENTI_OBJTYPE_ID = 000
String PARENT_OT = "clienti"
String UO_LOC_ATTR_ID = 000
String IQL_FIND_CHILDREN = "objecttype IN objectTypeAndChildren(\"%s\") AND object HAVING outboundReferences(key IN (\"%s\")))"
def uo_loc_parent = GetInsightValue(log, CLIENTI_OBJTYPE_ID, UO_LOC_ATTR_ID)
List children = GetInsightObjects(OBJSCHEMA_ID, String.format(IQL_FIND_CHILDREN, PARENT_OT, object.objectkey))
for(def child: children) {
if (uo_loc_parent != null) {
SetInsightValue(log, child.id, UO_LOC_ATTR_ID, uo_loc_parent)
}
}
// Auxiliaru Insight functions
List GetInsightObjects(int objectSchemaId, String iql) {
Class iqlFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.IQLFacade")
def iqlFacade = ComponentAccessor.getOSGiComponentInstanceOfType(iqlFacadeClass)
return iqlFacade.findObjectsByIQLAndSchema(objectSchemaId, iql) // See the complete list of possible IQL on the Insight Query Language documentation page
}
def GetInsightValue(def log, int InsightObjectId, int InsightAttributeId) {
/* 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);
/* Get Insight Configuration Facade from plugin accessor */
Class configureFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ConfigureFacade");
def configureFacade = ComponentAccessor.getOSGiComponentInstanceOfType(configureFacadeClass);
def attribType = objectTypeAttributeFacade.loadObjectTypeAttributeBean(InsightAttributeId).getType().name();
def insightObjectAttributeValueBeans = GetInsightObject(log, InsightObjectId, InsightAttributeId);
if (insightObjectAttributeValueBeans == null) {
return null;
}
insightObjectAttributeValueBeansCount = insightObjectAttributeValueBeans.size();
ArrayList listOfValues = new ArrayList();
for (def insightObject: insightObjectAttributeValueBeans) {
if (insightObject == null) {
listOfValues.add(null);
} else {
def value = insightObject.getValue();
if (attribType.equals("STATUS")) {
result = configureFacade.loadStatusTypeBean(value).getName();
listOfValues.add(result);
} else {
listOfValues.add(value);
}
}
}
return listOfValues;
}
boolean SetInsightValue(def log, int InsightObjectId, int InsightAttributeId, def NewValue) {
/* Get Insight Object Facade from plugin accessor */
Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade");
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass);
/* Get Insight Object Type Facade from plugin accessor */
Class objectTypeFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeFacade");
def objectTypeFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectTypeFacadeClass);
/* 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 obj = objectFacade.loadObjectBean(InsightObjectId);
if (obj == null) {
return false;
} else {
}
attribType = objectTypeAttributeFacade.loadObjectTypeAttributeBean(InsightAttributeId);
if (attribType == null) {
return false;
} else {
log.debug("SETINSIGHTVALUE: Attribute type for Insight object: " + attribType);
}
newAttrib = obj.createObjectAttributeBean(attribType);
def newAttribValue = newAttrib.createObjectAttributeValueBean();
try {
newAttribValue.setValue(attribType, NewValue);
} catch (Exception vie) {
return false;
}
def attribValues = newAttrib.getObjectAttributeValueBeans();
attribValues.add(newAttribValue);
newAttrib.setObjectAttributeValueBeans(attribValues);
try {
newAttrib = objectFacade.storeObjectAttributeBean(newAttrib);
} catch (Exception vie) {
return false;
}
return true;
/*
EXAMPLES FOR USING THIS FUNCTION
objectId = 29461 //zny7jhillold
objectId = 4815
attributeId = 42713 //truefalse
//attributeId = 42682 //BuildDate
//attributeId = 42647 //Cost (double)
//attributeId = 42648 //purchase order number (integer)
//attributeId = 42629 //Site (referenced object)
//attributeId = 42626 //description (text)
//attributeId = 42530 // Name (textshort)
//attributeId = 42641 //ManagementOption1 (Select)
//attributeId = 42632 //Lifecycle State (Status)
boolean result = SetInsightValue(log, objectId, attributeId, true); //boolean
result = SetInsightValue(log, objectId, attributeId, Date.parse("yyyy-MM-dd", "2018-05-03")); //date
result = SetInsightValue(log, objectId, attributeId, new BigDecimal(5.1).doubleValue()) //double
result = SetInsightValue(log, objectId, attributeId, 5); //integer
result = SetInsightValue(log, objectId, attributeId, 10057); //referencedobject
result = SetInsightValue(log, objectId, attributeId, "DISPOSED"); //text
*/
}
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.
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.