Hi, I have a Scriptrunner Behavior who (on the service desk portal) has to take over the values of an issue selected in an issue picker field in Insight Custom Fields. Only the value of an Insight referenced custom field is not taken over.
This is the script.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade")
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass)
def issueManager = ComponentAccessor.getIssueManager() as IssueManager
def issuePickerCustomFieldValue = getFieldById(getFieldChanged()).value
def relatedIssue = issueManager.getIssueByCurrentKey(issuePickerCustomFieldValue as String)
def EngineerPACustomField = getFieldByName("Engineer E/PA")
def EngineerPACustomFieldObject = customFieldManager.getCustomFieldObjectsByName("Engineer E/PA")[0]
def EngineerPACustomFieldValue = (EngineerPACustomFieldObject ? relatedIssue.getCustomFieldValue(EngineerPACustomFieldObject) : null) as String
if (EngineerPACustomFieldValue) {
def objectKeyStr = EngineerPACustomFieldValue.substring(EngineerPACustomFieldValue.indexOf("(")+1,EngineerPACustomFieldValue.indexOf(")"))
EngineerPACustomField.setFormValue(objectKeyStr)
}
def SystemIntegratorCustomField = getFieldByName("System integrator")
def SystemIntegratorCustomFieldObject = customFieldManager.getCustomFieldObjectsByName("System integrator")[0]
def SystemIntegratorCustomFieldValue = (SystemIntegratorCustomFieldObject ? relatedIssue.getCustomFieldValue(SystemIntegratorCustomFieldObject) : null) as String
if (SystemIntegratorCustomFieldValue) {
def objectKeyStr1 = SystemIntegratorCustomFieldValue.substring(SystemIntegratorCustomFieldValue.indexOf("(")+1, SystemIntegratorCustomFieldValue.indexOf(")"))
SystemIntegratorCustomField.setFormValue(objectKeyStr1)
}
def MedewSystemIntegratorCustomField = getFieldByName("Medewerker System integrator")
def MedewSystemIntegratorCustomFieldObject = customFieldManager.getCustomFieldObjectsByName("Medewerker System integrator")[0]
def MedewSystemIntegratorCustomFieldValue = (MedewSystemIntegratorCustomFieldObject ? relatedIssue.getCustomFieldValue(MedewSystemIntegratorCustomFieldObject) : null) as String
if (MedewSystemIntegratorCustomFieldValue) {
def objectKeyStr2 = MedewSystemIntegratorCustomFieldValue.substring(MedewSystemIntegratorCustomFieldValue.indexOf("(")+1, MedewSystemIntegratorCustomFieldValue.indexOf(")"))
MedewSystemIntegratorCustomField.setFormValue(objectKeyStr2)
}
"PA Project" is a Issue picker field.
"Medewerker System integrator" is an Insight referenced custom field and this is not copied from the chosen issue.
"Engineer E / PA" (User Picker (single user) field) and "System Integrator" (Insight Object/s field) are copied correctly.
How do I get this working?
regards, Marco
@Vincent Lee , did you find a way to make it work on your side because I have sam issue when using it under console editor within Jira.
The Intellisense seems to work when it wants to but most of the time it does not and I never get intellisense as explain in the doc.
Any new from yourside ?
regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
As we mentioned above, please follow the open bug report for this here: https://productsupport.adaptavist.com/browse/SRJIRA-4027
Kind regards,
Katy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please follow the open bug report for this here: https://productsupport.adaptavist.com/browse/SRJIRA-4027
Regards,
Katy
Adaptavist Product Support
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.