I'm using the scriptrunner post function create sub task template.
The subtask is being created as expected but i'm trying to update a custom field when the task is created. When i use some code that i found on the Adaptavist website i get an error
https://library.adaptavist.com/entity/update-the-value-of-custom-fields-through-the-script-console
this is the code in the script context window
def response = put("/rest/api/2/issue/${issue.key}")
.header("Content-Type","application/json")
.body([
fields:[
customfield10076: 'Change Exception Approver'
]
])
.asString()
Error
2020-01-07 14:58:13.679 WARN - PUT request to /rest/api/2/issue/RFC-7031 returned an error code: status: 400 - Bad Request
body: {"errorMessages":[],"errors":{"customfield10076":"Field 'customfield10076' cannot be set. It is not on the appropriate screen, or unknown."}}
2020-01-07 14:58:13.925 INFO - PUT /rest/api/2/issue/RFC-7031 asString Request Duration: 3200ms
2020-01-07 14:58:15.548 INFO - Serializing object into 'interface java.util.Map'
2020-01-07 14:58:15.549 INFO - POST /rest/api/2/issue asObject Request Duration: 1590ms
2020-01-07 14:58:15.559 INFO - Created subtask completed customfieldid10076 is the custom field that i'm trying to update. I've confirmed that it is on the screen for the sub-task. The custom field is a single group picker.
If i use the same code and try to update the description it works fine so the issue is definitely to do with the customfield.
Any help appreciated