I am developing a Forge UI Kit app. I created a custom field in the manifest:
jira:customField:
- key: my-field
name: My Field
description: Desc of My Field
type: number
searcher: exact
readonly: true
I made the field readonly because I only want the app to update this field. Here is the code I use to update it:
import { requestJira } from '@forge/bridge';
...
// issueId = The jira issue id
// fieldId = 'customfield_12345'
// value = a number (e.g. 5)
console.debug(`Updating custom field value for issue: ${issueId}, field: ${fieldId}, value: ${value}`);
var bodyData = `{
"updates": [
{
"issueIds": [
${issueId}
],
"value": ${value}
}
]
}`;
const response = await requestJira(`/rest/api/3/app/field/${fieldId}/value`, {
method: 'PUT',
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
body: bodyData
});
I can see the response in my browser network tab is:
{
"errorMessages": [
"Only apps can access this resource (impersonated requests are not allowed)."
],
"errors": {}
}