Originally asked by David Oosting on 10 August 2021 (original question)
Attempting to pass the Group Assigned from Jira to Zendesk so that the ticket in Zendesk can get reassigned. Current code i am using is:
replica.customFields.“Group Assigned” = issue.customFields.“Group Assigned”.value
But getting this error
Unexpected error occurred. The customfield `Group Assigned`
was assigned to `value=[
{name=Customer Service, self=Products | Atlassian}
]
class=java.util.ArrayList`, but it should have been set to a custom
field object Generate an exalate support.zip file and contact support.
When i try
replica.customFields.“Group Assigned” = issue.customFields.“Group Assigned”
I get nothing sent.
Comments:
Ariel Aguilar commented on 10 August 2021
Hi David,
There are a couple of important details that you will need to share as we help you out. In Zendesk, is it a ticket field or user field? What type of field is it ? (Drop-down, Multi-select, Checkbox?) What is the incoming script for Jira? What type of field is it? (Drop-down, Multi-select (single choice), Checkbox etc…)
Kind regards,
Ariel
David Oosting commented on 10 August 2021
It is a ticket drop-down with multi-select. But looking at the Incoming and Outgoing, I am not seeing anything under customField except {}
Dave
Ariel Aguilar commented on 10 August 2021
In Zendesk, is it a drop-down? And in Jira, multi select single choice? If you are sending from Jira to Zendesk. The Jira Outgoing should be:
replica.customFields."Group Assigned" = issue.customFields."Group Assigned"
Kind regards.
Ariel
David Oosting commented on 10 August 2021
Jira Local:
"customFields": {
"Group Assigned": {
"id": 10056,
"name": "Group Assigned",
"uid": "10056",
"type": "UNHANDLED",
"value": [
{
"name": "Customer Service",
"self": "https://atlassian.net/rest/api/2/group?groupname=Customer+Service"
}
]
}
Jira Remote:
"customFields": {},
Zendesk Local:
"customFields": {},
Zendesk Remote:
"customFields": {
"Group Assigned": {
"id": 10056,
"name": "Group Assigned",
"uid": "10056",
"type": "UNHANDLED",
"value": [
{
"name": "Customer Service",
"self": "https://atlassian.net/rest/api/2/group?groupname=Customer+Service"
}
]
}
David Oosting commented on 10 August 2021
So trying to get customFields.“Group Assigned”.value.name is not working.
Ariel Aguilar commented on 11 August 2021
Hi David,
Without confirming Jira Outgoing, Jira Incoming, Zendesk Outgoing, Zendesk Incoming scripts and the type of fields for both, it would be hard to continue.
Kind regards,
Ariel
David Oosting commented on 11 August 2021
Right now im just attempting to get the the if statement to work.
if(issue.customFields.“Group Assigned”.value.name == “Customer Service”) {
issue.labels += nodeHelper.getLabel(“customer_service”)
}
David Oosting commented on 11 August 2021
It does not.
No such property: name for class: com.google.gson.JsonArray
David Oosting commented on 11 August 2021
the .value equals an array
[{"name": "Customer Service","self": "https://atlassian.net/rest/api/2/group?groupname=Customer+Service"}]
and dot notation is not picking name from that array.
Ariel Aguilar commented on 12 August 2021
Hi David,
If you do:
if(replica.customFields."Group Assigned".value.name.contains("Customer Service")) {
issue.labels += nodeHelper.getLabel("customer_service")
}
Kind regards,
Ariel
David Oosting commented on 12 August 2021
No such property: name for class: com.google.gson.JsonArray
David Oosting commented on 18 August 2021
Hey Ariel, any update on this?
Ariel Aguilar commented on 20 August 2021
Hi David,
If you change it to:
if(replica.customFields."Group Assigned".value.get(0).name == "Customer Service") {
issue.labels += nodeHelper.getLabel("customer_service")
}
Let me know if this works for you,
Kind regards,
Ariel
David Oosting commented on 20 August 2021
if(replica.customFields.“Group Assigned”.value.get(0).name == “Customer Service”) showing Not TRUE.
customFields": {
"Group Assigned": {
"id": 10056,
"name": "Group Assigned",
"uid": "10056",
"type": "UNHANDLED",
"value": [
{
"name": "Customer Service",
"self": "https://atlassian.net/rest/api/2/group?groupname=Customer+Service"
}
]
}
Ariel Aguilar commented on 23 August 2021
Hi David,
Can you try this:
if(replica.customFields."Group Assigned".value.find()?.toString()?.name?.contains("Customer Service")){
issue.labels += nodeHelper.getLabel("customer_service")
}
Kind regards,
Ariel
David Oosting commented on 23 August 2021
That doesnt work also. No such property: name for class: java.lang.String →
if(replica.customFields."Group Assigned".value.find()?.toString()?.name?.contains("Customer Service"))