Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Updating a Custom Field using webhookResponse.body.accountid

Doug Winenger September 22, 2023

We're implementing the Connector for Salesforce and Jira from Service Rocket (now Appfire) in Jira Cloud.

We're setting up this automation that will pull the value of a people field from Salesforce and update the reporter or assignee people field in JIRA. 

However, we want to apply one modification: we don't want to update the reporter or assignee people field.  Instead, we want to update a custom people field we've created in our project.

We setup the automation as designed and have successfully updated the reporter field.

When we attempt to swap out the reporter field as the target of the "Edit Issue" update with our custom people field, we get an error "data was not an array (customerfield_123456)" where 123456 is our custom field's ID.

The following is the Edit Issue Advanced Field editing / Additional Fields json script we're using (which is standard other than the reference to our custom field name):

This fails:

{
"fields": {
"Custom - field":{"id":"{{webhookResponse.body.accountid}}"}
}
}

 

This works:

{
"fields": {
"reporter":{"id":"{{webhookResponse.body.accountid}}"}
}
}

I know the field reference "Custom - field" is correct because the error message in the automation audit log returns the custom field ID (not the name).    

 

 

2 answers

1 accepted

1 vote
Answer accepted
Matthias Gaiser _K15t_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 25, 2023

Hi @Doug Winenger

the error message "data was not an array (customerfield_123456)" sounds to me like you did not provide an array of users but only one user instead.

Is it possible that your user field is a user field which allows to define multiple users in there? There's a custom field for single users and also one for multiple ones.

If this is the case, you can modify your request to send an array instead:

{
"fields": {
"Custom - field": [ {"id":"{{webhookResponse.body.accountid}}"} ]
}
}

This would always replace all users in the user field, there are also other options to only add that user. You can check out this example of the components field.

Hope that helps,
Matthias.

Doug Winenger September 25, 2023

@Matthias Gaiser _K15t_ this was exactly the issue - such a simple change :). Now this automation is working!!!

Like Matthias Gaiser _K15t_ likes this
1 vote
Syed Majid Hassan -Exalate-
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.
September 23, 2023

Hi Doug,

This is Majid @ Exalate. 

My troubleshooting approach would be to first run an API call (postman/curl) and test if you are able to set it ok. Then, maybe try to hard code a user in your config to see if that works, and then finally, move on to dynamically doing this from a SF transaction. 

At Exalate, we abstract away these complexities by employing a simple scripting solution, and the troubleshooting of this becomes really easy as well. 

Hope it helps. 

Thanks

Majid

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events