Hello,
I am currently experiencing an issue with my Jira script for updating/changing assets. Below is the code I'm using:
"
def objectType = objectTypeFacade.loadObjectTypeBean(originalObject.getObjectTypeId())
def newObjectBean = objectType.createMutableObjectBean()
newObjectBean.setId(originalObject.getId())
newObjectBean.setObjectAttributeBeans(attributes)
try {
objectFacade.storeObjectBean(newObjectBean)
} catch (Exception e) {
log.info("Error: " + e)
}
"
In one use case, although I receive an error message stating:
"com.riadalabs.jira.plugins.insight.common.exception.RuntimeInsightException: InsightRuntimeException: java.lang.NullPointerException; nested exception is: null"
but the asset is still updated correctly.
However, in another use case, when I encounter the following error:
"com.riadalabs.jira.plugins.insight.common.exception.ValidationInsightException: ValidationInsightException: Validation errors were found: rlabs-insight-attribute-1240: ErrorMessage{i18nKey='rlabs.insight.i18n.constraint.violation.unique', parameters=[uncode], additionalMessage=null};"
the asset fails to update. Using the "objectFacade.storeObjectBeanIgnoreAttributeValidation(newObjectBean)" method allows for a successful update, although it throws the same error as in the first use case.
I have been unable to find a solution for these errors, and I would greatly appreciate any assistance or insights that can be provided.
Hi community and all,
This script runs when new object is being created and checks if database already has another object with the same "Name".
If yes, then it does two things:
There are two separate errors here which we would like to get help with. @PD Sheehan you have excellent knowledge in this, I would use possibility and mention you here again. :D
Is there any idea or puprose why we need to store object with IgnoreAttributeValidation when saving/updating already existing object OBJ-50?
objectFacade.storeObjectBeanIgnoreAttributeValidation(newObjectBean)
=> As OBJ-1 was used in one of OBJ-50 attribute values, so this new OBJ-100 needs to be added to OBJ-50 attributes.
We have one attribute in this OBJ-50 schema which has "Unique" constraint. If we don't have unique constraint, we don't need to use IgnoreAttributeValidation. If we have, we need to use it, otherwise we are not able to save the same object. Is this kind of expected behaviour when using Groovy scripts to ignore attribute validation? Or is there something we are missing when we are saving the same object?
Although all necessary attributes are being copied from OBJ-1 (old) to OBJ-100 (new) and OBJ-100 is saved correctly, we are getting "nested exception: null". Script itself does not return false nor it exists, all OBJ-100 is being updated correctly.
Somewhy after createMutableObjectBean this newObjectBean becomes null.
def objectAttributes = objectFacade.findObjectAttributeBeans(object.getId());
def allAttributes = objectAttributes + getAttributes(atts, fromObject.getId());
def objectTypeVirtualGuest = objectTypeFacade.loadObjectTypeBean(object.getObjectTypeId());
def newObjectBean = objectTypeVirtualGuest.createMutableObjectBean();
newObjectBean.setId(object.getId());
newObjectBean.setObjectAttributeBeans(allAttributes);
newObjectBean = objectFacade.storeObjectBean(newObjectBean);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.