Status Property is blocking Transition ScriptRunner Post-Function

Emil Khairov May 11, 2023

Hello,

 

I have noticed a weird behavior. Maybe it is the lack of experience that makes this situation weird for me; however, I have noticed that if you set the following properties for a final status (Closed/Resolved/Done...), ScriptRunner Post-Functions are being blocked. Simple "Update Custom Field" post-function with the usage of %%CURRENT_DATETIME%% is working properly.

Properties that I am setting when the final status is assigned.

jira.issue.editable - false
jira.permission.comment.denied - true

 ScriptRunner post-function that is being blocked is used to calculate the difference between 2 custom date time field values and update the custom short text field with the result.

So, these are the steps:

  1. Update the Created custom date time field at some previous point.
  2. When transitioning to the final status (in my case - Closed)
    1. Update the Finish Date custom date time field
    2. Run ScriptRunner post-function to get values from Created, and Closed, calculate the difference and update the short text custom field with the result.

This is the error that I get when properties are assigned to the final status:

2023-05-11 12:52:20.864 INFO - Serializing object into 'interface java.util.Map'
2023-05-11 12:52:20.866 INFO - GET /rest/api/2/issue/SD-48208?expand=names asObject Request Duration: 434ms
2023-05-11 12:52:20.868 INFO - Created - Thu May 11 16:51:58 UTC 2023
2023-05-11 12:52:20.868 INFO - Closed -   Thu May 11 16:52:19 UTC 2023
2023-05-11 12:52:20.868 INFO - Difference 21.000 seconds
2023-05-11 12:52:21.103 INFO - PUT /rest/api/2/issue/SD-48208 asString Request Duration: 234ms
2023-05-11 12:52:21.104 WARN - PUT request to /rest/api/2/issue/SD-48208 returned an error code: status: 400 - Bad Request
body: {"errorMessages":[],"errors":{"customfield_10171":"Field 'customfield_10171' cannot be set. It is not on the appropriate screen, or unknown."}}
2023-05-11 12:52:21.104 INFO - Serializing object into 'interface java.util.Map'
2023-05-11 12:52:21.104 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 

2023-05-11 12:52:21.104 INFO - Run script completed

Thank you!

1 answer

0 votes
Emil Khairov May 11, 2023

The issue might be with the screen that is set to appear on that transition. I am currently testing that.

Emil Khairov May 11, 2023

No, seems like the issue is not with the screen.

Suggest an answer

Log in or Sign up to answer