api jira - custom field within "com.atlassian.jira.plugins.cmdb:cmdb-object-cftype"

javier May 14, 2022

Hi

I have this schema for a custom field

 

"customfield_10020": {
        "required": false,
         "schema": {
         "type": "array",
         "items": "cmdb-object-field",
          "custom": "com.atlassian.jira.plugins.cmdb:cmdb-object-cftype",
          "customId": 10020
},
"name": "Rotation",
"key": "customfield_10020",
"operations": [
     "set"
],
"configuration": {
      "multiple": true,
        "attributesIncludedInAutoCompleteSearch": [
         "Name"
],
"isInsightAvailable": true
}
},
1. What type of field is com.atlassian.jira.plugins.cmdb:cmdb-object-cftype
2. Which would it be the json to create an issue via api?. How can I post data to this field?
ie:
   "customfield_10020":
           .......¿?
}
Thanks

1 answer

0 votes
Nic Brough -Adaptavist-
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.
May 14, 2022

Strictly speaking, the field type is "com.atlassian.jira.plugins.cmdb:cmdb-object-cftype".  The class name is used as the unique field type descriptor in the code,

For this type though, I understand that it is "Insight" providing the field type.  There are some examples of using the field with the REST API at https://confluence.atlassian.com/insightapps/insight-with-jira-rest-api-1085180905.html

javier May 16, 2022

Thanks for the anwser. In that example:

{"key" : "TEST-1"}

Key is the "key" of the field customfields_100010 and "TEST-1" is the value of the field customfield_10010?

 "customfield_10100" : [{"key" : "TEST-1"}],
 "customfield_10200" : [{"key" : "TEST-1"}, {"key" : "TEST-2"}]

I gave a try  with json data when I've created and issue and doesn't add the value of the field "24Q" within the ticket.

 "customfield_10064" : [{"customfield_10064" : "24Q"}],

The "key" of the field "customfield_10064" is "customfield_10064". I have it from the endpoint:

https://mydomin.atlassian.net/rest/api/2/issue/TAPP-18/editmeta

Nic Brough -Adaptavist-
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.
May 16, 2022

What error do you get in the response?

javier May 16, 2022

I don't get error, but when I go to see the created ticket in jira, it doesn't show the value 24Q in that field.

I don't understand!, Can it be that the user must field this customfield_10064 manually?

This is my json:

{
      "fields": {
             "summary": "ticket from app",
             "issuetype": {
                  "id": "10005",
              },
             "customfield_10064" : [{"customfield_10064" : "24Q"}],
              "project": {
                    "key": "PJT"
               },
      }

}

 

And this the matadata of this field:


"customfield_10064": {
          "required": false,
            "schema": {
                   "type": "array",
                    "items": "cmdb-object-field",
                    "custom": "com.atlassian.jira.plugins.cmdb:cmdb-object-cftype",
                     "customId": 10064
              },
              "name": "Concession",
              "key": "customfield_10064",
              "autoCompleteUrl":                                  "https://mydomain.atlassian.net/rest/servicedesk/cmdb/1/field/customfield_10064/config/10167/autocomplete?",
              "operations": [
                     "set"
                ],
               "configuration": {
                      "multiple": true,
                       "attributesIncludedInAutoCompleteSearch": [
                                      "Name"
                          ],
                        "isInsightAvailable": true
                  }
},

Nic Brough -Adaptavist-
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.
May 16, 2022

Ok, so what do you get in response?

javier May 16, 2022

ok, 200. 

"{\"id\":\"25765\",\"key\":\"PJT-14810\",\"self\":\"https://mydomain.atlassian.net/rest/api/3/issue/25765\"}"

 

 

Suggest an answer

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

Atlassian Community Events