Customfield - Type "Object". How to allow "SearchAlias" on array schma type?

Hello,

I am trying to create a customfield with the type object.
As part of the properties of the object I would like to have an array with users.

According to the documentation:

" array schema type becomes an array of items of a type following these rules. For example, an array containing items with the schema type integer becomes an array of items with the type number in JQL."

My current take on how to init the array in the manifest schema looks like this:
image

Sadly this does not allow me to search for the property “testArray” in JQL.

Thanks

Hello, @WolfgangLandes,

You also need to define the type of items in the array. This should work:

schema:
  properties:
    testArray:
      type: array
      searchAlias: testArray
      items:
        type: integer # for example

Let me know if this helps :slight_smile:

2 Likes

Hi @kkercz ,
works like a charm!
Thanks for the fast and helpful response.

I assume for user I would just use “type: user” and store the accountId.

Is there a possible support for nested JSON:
Example:
{“testArray”: {“user”:"", “value”:""}}

1 Like

I’m happy to hear it works now!

We don’t plan to support indexing arrays of objects. In this case the solution is to have two separate arrays of plain values, one for user, and one for value.

@kkercz Follow up question using the suggested approach.

I want to add one entry via Jira api ‘update’.

I can’t get the syntax right.

{
    "update": {
        "<fieldName>": {
                          "user":[{ 
                                     "add": "user1"}],
                           "value":[{
                                      "add":"value1"}]
              }
       }
}

Try this:

{
  "fields": {
    "customfield_xxxxxx": {
      "user": ["user1"],
      "value" :["value1"]
    }
  }
}

Thanks for the quick response.
I should have specified. I was able to get the “fields” syntax to work.
But I want to add values without overwriting existing values. Therefore the
“update” and “add” syntax.

Ah, gotcha. I’m afraid that is not possible, you need to provide the full new value when updating issues.