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

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",  
"autoCompleteUrl": "<https://domain.atlassian.net/rest/servicedesk/cmdb/1/field/customfield_10020/config/10167/autocomplete>?",  
"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


Answers:
author: Nic Brough -Adaptavist-
body: 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>

comments: author: javier
body: 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>


author: Nic Brough -Adaptavist-
body: What error do you get in the response?


author: javier
body: 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:

<br />

"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  
}  
},


author: Nic Brough -Adaptavist-
body: Ok, so what do you get in response?


author: javier
body: ok, 200.

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


Tags: bitbucket-cloud

cloud