Forums

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

Using PowerScript to validate JIRA REST API request

Kevin Huang
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 3, 2019

Hi,

Is it possible to use PowerScript/ScriptRunner to validate the data when creating/updating a JIRA issue from REST APIs? Instead of using a validator in a transition, I need to validate data when doing a simple update (e.g. update a customfield).

If not possible, is there a way to control the response?

Thank you.

1 answer

1 vote
Anna Hryhoruk _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 6, 2025

Hello @Kevin Huang 

I know this is quite an old question, but maybe other people could also benefit from it. 
To my knowledge, Power Scripts does not natively provide a way to validate issue updates at the API level before they are processed. But I want to suggest different way. 

Since you cannot block the update at the API level, you can listen to issue updates using SIL Listeners and take corrective action if the data is invalid. You attach sil script to the listener that check field changes using lastIssueChanges() or getFieldChanges(), check if the update meets your conditions, and revert it if necessary. If an invalid update is detected, you can reset the field , log the change, or notify the use. This won’t block the REST API request but lets you enforce validation rules by rolling back unwanted changes. 

Hope it helps!
Anna

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events