Edit restriction on (workflow transition) destination status makes issue uneditable in scriptrunner

There is a transition of a workflow between create and in-progress statuses. A scriptrunner post-function is attached to the transition, which edits the running issue via rest api call. The destination status has a property
jira.permission.edit.group = jira-managment
in the workflow settings which makes the issue (with in-progress status) uneditable for a user outside of the jira-managment group. My problem is that the scriptrunner is called after the destination status is set, so the rest api call fails on the editable custom fields on the issue if such a user started the transition. The script wants to write some fields on the issue.

PUT /rest/api/2/issue/SZB2-143?overrideScreenSecurity=true&overrideEditableFlag=true asObject Request Duration: 365ms
2021-05-03 13:09:11.770 WARN - PUT request to /rest/api/2/issue/SZB2-143?overrideScreenSecurity=true&overrideEditableFlag=true returned an error code: status: 400 - Bad Request
body: {errorMessages=[], errors={customfield_10115=Field 'customfield_10115' cannot be set. It is not on the appropriate screen, or unknown., summary=Field 'summary' cannot be set. It is not on the appropriate screen, or unknown.}}
2021-05-03 13:09:11.770 ERROR - Please use the ScriptRunner user to complete this task not the Initiating User.
See https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-editIssue for more information.
If you are using the ScriptRunner user then check the Field Configuration

I do use ScriptRunner Add-on user starting the script in scriptrunner and included overrideScreenSecurity request parameter to the api call. It seems the fields to be written do not exist because of the prohibited edit.

How can I start and finish a script after the create screen is submitted but before the destination status is set? It would be a solution if I can set a similar edit prohibiton only on the running issue ( via rest api) instead of the workflow’s status object, but as far as know it is unsupported.

1 Like