Forums

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

Help on ScriptRunner validator where reporter is not approver

Fernando Jr. Jeno November 18, 2021

We do not want ticket creator/reporter to be able to add themselves as approver in the "Approvers" user picker(multiple users) field in JSM.

I checked somewhere that this could be possible using a scriptrunner validator in the create transition but I am not sure how to write the script.

I tried using the script below but it failed.

issue.reporter.username != cfValues["Approvers"].username

 

1 answer

0 votes
Ivan Lima
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.
November 21, 2021

Hi, @Fernando Jr. Jeno, you can try something like the following snippet:

issue?.customfield_10003?.filter(a => a.accountId == issue.reporter.accountId)[0]?.accountId != issue.reporter.accountId

Replace the  customfield_10003 with your Approvers' custom field ID. I'm sure there are better ways to code this, but you can give it a try. It should work.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events