Hi all,
this week end, we proceed to some jira upgrade (V 9.12.2). so from this time a major Behaviours script is no longer working.
After some search, it seems the Insight (now Assets) custom fields are not populated correctly
I rework the initial script, and test Asset creation (works fine), but the setFormField never display the value needed
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade
import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeAttributeFacade
import com.riadalabs.jira.plugins.insight.services.model.ObjectBean
import groovy.transform.BaseScript
@WithPlugin('com.riadalabs.jira.plugins.insight')
@BaseScript FieldBehaviours fieldBehaviours
@PluginModule ObjectFacade objectFacade
@PluginModule ObjectTypeAttributeFacade objectTypeAttributeFacade
def FTestValue = getFieldById("customfield_xxxxx")
def FInsightCf = getFieldById("customfield_yyyyy")
def cfvalue = Assets.getById(aaaaa)
log.warn("testvalue is:" + cfvalue.getLabel())
FTestValue.setFormValue(cfvalue.getObjectKey())
FInsightCf.setFormValue(cfvalue)
at this point, the FtestValue (simple text customfield) show correctly the Asset Key of seelcted object
but the FInsightCf.setFormValue(cfvalue) didin't set the custom field
I tried in several ways such as setFormValue(["TheKey"]) setFormValue("TheKey") setFormValue(TheId), setFormValue(Assets.getByKey('AAA-1').. . but nothing happened.
checking this page https://docs.adaptavist.com/sr4js/latest/hapi/work-with-assets-insight but found nothing interesting in my case
Thank you
Hi DX.
Working with Behaviours and Assets fields is abit funky, and I haven't worked with it since it was called insight, however I have some experience
Have you tried to set it the same way as FTestValue?
FInsightCf.setFormValue(cfvalue.getObjectKey())
Maybe thats what you mean by: setFormValue("TheKey").. However thats how I usually have set the asset/insight field on a behaviour.
Can you see anything in the logs?
Dear @Manne Kjærby - ProProces
thank you for your quick answer, but the test value retrieve the correct Asset Key.
but for the InsightCF, whatever I use as code to (even your code) not working :(
regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi D X.
Hmm. I believe you're best option is to reach out to adaptavist as scriptrunner is their product - Maybe they are aware of what have changed?
Have you tried to hardcode an asset into like FInsightCf.setFormValue("ABS-123") ?
I hope you figure it out.
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.