Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Validator on Create issue not working.

Nick Hassell
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 25, 2020

I want to ensure that all issues of a given issue type are created via the Portal.

I have Cloud ScriptRunner and have written a Workflow Validator as follows:

(issue.properties['request.channel.type']['value'] == 'portal') ? true : false

I have successfully tested this against existing issues.  However, when I add this condition to the Create transition, it always returns false.  If I change the if condition from 'portal' to null, then it still returns false.

Am I doing something wrong?  Are there any alternatives?

2 answers

0 votes
Viktor May 28, 2020

I have a similar issue.

Validator works when testing with JMWE addon, that is, making sure Reporter is in a group.

However, it has no effect on Service Desk portal and everyone can create the request type.

Radhika Vijji _Innovalog_
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.
May 29, 2020

Hi Viktor,

Can you share what you configured? What you need is a Build-your-own validator with the following Jira expression:

user.groups.includes("jira-users")

It should block the user from creating the issue, but the error message displayed is the standard message and not the message configured in the validator. That is a known issue in Jira Cloud.

Regards,

Radhika 

Like Viktor likes this
Viktor May 29, 2020

Thank you.

Turns out I misclicked when I selected the Workflow issue type scheme.

Works now, but the validation error message, unfortunately, is not displayed on the portal.

0 votes
Nick Hassell
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 26, 2020

On doing some more testing, it seems that issue.properties is null on issue creation. I guess this is by design?

Marini Marini
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.
August 4, 2023

@Nick HassellDone a few tests too. I think you are right. issue.properties value will be set after the issue creation. Thus, there is no way for checking if a user tries to create an issue from Jira/portal/API using a validator in Create issue transition.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events