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

Data was not an array for a Insight objects field

Fabio Manzoni December 19, 2022

Hi Guys, 

I'm creating an automation that when a value is changed it is updated in another issue that is linked.

 

However, the field is an Insight object and it does not appear in the list of available fields, I am using the advanced session and I receive an error message Data was not an array

 

This is my code 

 

{
"fields": {
"customfield_XXXX":"{{triggerIssue.fields.customfield_XXXXX}}"
}
}

Can someone help me?

BR,

Fabio

2 answers

0 votes
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 19, 2022

WELL. This was a journey.

As you discovered, @Fabio Manzoni for some reason Asset object custom fields apparently no longer show up in the Edit Fields action. I don't know if this is a change from Insight being an add-on to now being integrated with JSM Premium but for whatever reason, these instructions DO NOT WORK:

Instead, you were right - this required Additional Fields (formatted in JSON), and I had to do a bunch of digging.

First off, you're going to need to do a Lookup objects to find the objects with your current issue:

Screen Shot 2022-12-19 at 2.41.46 PM.png

object HAVING connectedTickets(key={{issue.key}})

That returns all objects connected to your ticket as a list. So then, using list operators, you can construct an array object. But hold on, you first need your Assets Workspace Id. I found this by going to:

https://MYSITE.atlassian.net/rest/servicedeskapi/assets/workspace

You need that Workspace ID because you'll need it for the JSON, as per this excellent reference: JSON input for fields (I took a wild guess that the long string was a Workspace Id)

So then, For Linked issues, I am Editing each one and this is what I'm putting into Additional fields:

{
   "fields": {
        "My Asset": [
         {{#lookupObjects}}{"id": "MYWORKSPACEID:{{id}}"}{{^last}},{{/}}{{/}}
      ]
   }
}

(Where my Asset object field is named "My Asset")

(OOOOF, after I dug all this info up myself, I found this KB article that has a little information about the change: Workarounds to automatically link the Asset object to Jira issues)

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 19, 2022

What's really odd is that last link is specifically talking about the "new" Assets in JSM, and makes it seem like the easier solution (just doing an Edit issue in Automation) ought to work:

Screen Shot 2022-12-19 at 3.03.00 PM.png

But in my testing, I could not see my Asset object custom field available for editing in Automation. 

@Grady Gausman or @Charlotte Nicolaou - since you've posted about Assets and Insights before, I'm wondering if you might know anything about this.

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 20, 2022

Ah, figured it out, thanks to opening a Support ticket and getting help from @Lucas Silva !

Even though my rule had a manual trigger, it was only scoped for a Single Project, and I guess Automation thought I might be trying to copy it to another project, per this KB article:

So to get the Asset field to show up for regular editing, I had to make my rule Global.

I was then able to create this much simpler rule:

Screen Shot 2022-12-20 at 2.00.22 PM.png

Your trigger, I assume, would be if the "My Asset" field is changed.

Like Lucas Silva likes this
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 20, 2022

Actually now that I've played with it, you probably want to just:

Copy YOUR FIELD from Current Issue

Like so:

Screen Shot 2022-12-20 at 2.03.04 PM.png

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 20, 2022

One caveat is that both using SET and COPY appear to add assets to the linked issue, but not REMOVE any. 

Fabio Manzoni December 27, 2022

@Darryl Lee 

I did your steps a few times and it showed a success message, but the issue was not edited.

I tried another approach and worked.

It so happens that my insight field (assets) is used in software and service management projects. And the copying of the values ​​occurs exactly between these types of project and that's reason that the field doens't appear.

To solve it, I set the automation to Global, so my field started to appear in the edit issue.

Once the configuration was done, I returned my automation to Multi-project and selected my projects. With that it worked normally.

Like Darryl Lee likes this
0 votes
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 19, 2022

Hi @Fabio Manzoni --

According to this KB article, there is a separate Automation action for Editing Objects - you don't edit it as a field:

Update object attribute values using automation with JSM Assets 

There's also links to several examples.

Hope this helps!

Fabio Manzoni December 19, 2022

Hi @Darryl Lee 

Thank you for your answer, but in my case I need to update a issue value. The documentation cannot help me.

 

Example that I need.

issue 1 the value is Database 

issue 2 the valueis empty

Both issues are linked then I need to copie the value Database to issue 2.

 

BR,

Fabio

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events