Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner email from JIRA project Insight CF not on email

Carla Ann Rowland
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 2, 2020

Our JIRA server project is a service desk and based on issue criteria sends an e-mail notification using post function (from Script Runner). We use insight add is version 8.3.0 (server);

The email works but noticed our Insight asset field is not displaying correctly. Have looked at mindville (aka riada) documentation and similar posts. ObjectFacadeClass is giving my co-worker and I.

Here is our code:

cfValues['Hardware Moved']?.value == "Yes" /* our flag to trigger email post function */
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.comments.Comment
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.fields.CustomField;
  
/* 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 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 the factory that creates Insight Attributes */
/*Class objectAttributeBeanFactoryClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.services.model.factory.ObjectAttributeBeanFactory");
def objectAttributeBeanFactory = ComponentAccessor.getOSGiComponentInstanceOfType(objectAttributeBeanFactoryClass);/*

This is the custom field with the value you want to add to an object attribute */
CustomField jiraCustomField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(12413);   // Change 12345 to the correct value/* This is the custom field where the object/s you want to set the value */
CustomField insightCustomField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(12413);   // Change 23456 to the correct value
def insightObjects = issue.getCustomFieldValue(insightCustomField);   // "issue" variable is always accessible in post function scripts./* This is the priority object type attribute and the one we want to modify */
def objectTypeAttributeBean = loadObjectTypeAttribute(123413, "Hardware AssetSmart Control Number");

 

 

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.5.4
TAGS
AUG Leaders

Atlassian Community Events