Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Update custom field with ScriptRunner HAPI post-function that is not present on the edit screen

József Porohnavec April 23, 2025

I'm encountering an issue with ScriptRunner in Jira when trying to update a custom field that is intentionally not present on the issue's Edit screen. The goal is to update this field programmatically via a workflow post-function using HAPI, preventing users from manually editing it.

Here's the scenario:

  • I have a custom field, "Approval status".

  • This field is not added to the Edit screen for any issue types. This is by design, as I don’t want this field to be updated by users.

  • I'm using a ScriptRunner script in a workflow post-function to set the value of "Approval status" to "Pending".

The problem is that the ScriptRunner script is failing to update the field. It seems ScriptRunner respects the screen configuration, even though I want to override it in this specific script.

Here's the HAPI code I'm using:

def currentIssue = Issues.getByKey(issue.key as String)

currentIssue.update {
    setCustomFieldValue('Approval status', 'Pending')
}

According to the ScriptRunner documentation, there is a mention of "overrideScreenSecurity=true” as a query parameter to allow editing fields that are not on the screen, but that's a PUT requests to the API and I would like to keep it clean, just using HAPI.

Has anyone encountered this issue before? Is there a workaround or a different approach to update a field that's not on the Edit screen using ScriptRunner in a workflow post-function?

Thanks.

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
2 votes
Answer accepted
Philipp Sendek
Community Champion
April 23, 2025
József Porohnavec April 24, 2025

Hi @Philipp Sendek

Thanks for sending me this; the search did not surface it. Exactly what I need.

TAGS
AUG Leaders

Atlassian Community Events