jira:customField:
- key: my-field
name: My Field
description: Description of my field
type: number
searcher: exact
readonly: true
# view:
# resource: ?
# isInline: true
# experience:
# - "issue-view"
function:
- key: updateMyField
handler: resolvers.updateMyField
I’ve created a custom field in my Jira Forge App. I want this to be viewable/exportable in JQL queries. I’m updating the field using the Update Issue REST endpoint:
export const updateIssueCustomField = async (
issueIdOrKey: string,
customFieldId: string,
value: any
): Promise<boolean> => {
try {
const response = await api.asApp().requestJira(route`/rest/api/3/issue/${issueIdOrKey}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
fields: {
[customFieldId]: value
}
}),
});
if (response.status === 204 || response.status === 200) {
console.log(`Successfully updated custom field ${customFieldId} for issue ${issueIdOrKey}`);
return true;
}
const errorText = await response.text();
console.error(`Failed to update custom field: ${response.status} ${response.statusText} - ${errorText}`);
return false;
} catch (error) {
console.error(`Error updating custom field ${customFieldId} for issue ${issueIdOrKey}:`, error);
return false;
}
};
I’m getting an error in my browser console:
Failed to set custom field score: 400 {“errorMessages”:,“errors”:{“customfield_10091”:“Field ‘customfield_10091’ cannot be set. It is not on the appropriate screen, or unknown.”}}
I’m wondering if adding the commented section in the above manifest is needed.