Answer by Francis Martens (Exalate) on 02 March 2022
Another question on this topic.
From JIRA, we have a Select list custom field on a screen when we Exalate to JSM.
We select an ‘Organization’ on this screen upon Exalation, the issue then gets Synced in JSM.
We want this Organization we select to be populated on the JSM ticket, this should go to the Organization custom list on JSM, which is managed by Insight. I think the complication potentially comes from the fact that the Organization list is managed by Insight.
At the moment, the Organization field on the JSM ticket is blank. You can type in an Organization in this field and it will populate.
This is what we have in our JIRA Connections outgoing script:
replica.customFields.“Organizations” = issue.customFields.“Organizations”
And this under our JSM incoming script:
issue.customFields.Organizations?.value = replica.customFields.Organizations.value?.collect { org -> org?.organizationName }?.findAll()
Hope this helps.
Comments:
Francis Martens (Exalate) commented on 02 March 2022
Hi Roy Chapman
Can you detail out what is not working at the moment. Is the organisation field not populating when doing an incoming sync?
Samuel Carter commented on 07 March 2022
Francis Martens (Exalate) Correct, the organization field is blank. Organization should be populated with the information from the select list on the previous screen.
Francis Martens (Exalate) commented on 13 March 2022
Hi Samuel Carter
Can you check if the field value assigned to the organizations field is what it should be.
You can do 2 actions
a) check out the right hand side calculated value by doing
def targetOrg = replica.customFields.Organizations.value?.collect { org -> org?.organizationName }?.findAll()
debug.error("Targetorg = ${targetOrg}")
When a sync transaction is triggered, an error will be raised containing the targetOrg - is it what you expect
b) Check out what value can be assigned to Organizations by hard coding something
I believe Organizations is an array, so you could try something like
issue.customFields.Organizations?.value = [ "Google", "Apple" ]
Give it a try.
Samuel Carter commented on 17 March 2022
Hi Francis,
Thanks for your suggestion and apologies for the delay in getting back to you.
Please see below for results of each solution:
a) Returns the following error ‘Cannot get property ‘value’ on null object’
b) When I put this in, it will successfully assign ALL the values which are included in the array, so Organizations field on JSM has ‘Apple’, Google’ and ‘Microsoft’ assigned to it.
Thanks and regards,
Sam
Francis Martens (Exalate) commented on 27 March 2022
Hi Sam,
Now it is my turn to be apological for the late reply.
a) it means that issue.customFields.Organizations is null - is this to be expected?
b) Should Microsoft not be part of it?
Francis Martens (Exalate) commented on 04 April 2022
From Roy Chapman
I have played with the debugging.
Previously the debug read
def organisations = replica.customFields."Organizations".value?.collect{
a -> a.value
}
debug.error("Targetorg = ${organisations}")
And generated
Targetorg = []
I have changed to read
def organisations = replica.customFields."Organizations".value?.collect{
a -> a.value
}
def Royorganisations = replica.customFields."Organizations"
debug.error("Targetorg = ${Royorganisations}")
And get this debug.
Targetorg = com.exalate.basic.domain.hubobject.v1.BasicHubCustomField@8ddb1275
What does this mean? Does this mean that a value is coming across? If so, where is the value? (I selected TAP as the value)
Francis Martens (Exalate) commented on 04 April 2022
Hi Roy Chapman
com.exalate.basic.domain.hubobject.v1.BasicHubCustomField@8ddb1275
is how groovy denotes an object. The class is BasicHubCustomField and its address is ddb1275
The reason why you get this, is because you assign the customField to the variable Royorganisations
def Royorganisations = replica.customFields."Organizations"
Note that this has nothing to do with the collect operation performed on replica.customFields.“Organizations”
That result is assigned to the variable ‘organisations’
I would rather to
debug.error("Targetorg = ${organisations}"
And see what gives.