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

Validator to restrict the Reporter in creating the same request again

Sriharsha August 16, 2022

Hello Team,

I need to restrict the reporter in creating the same request (Ex: Request for a New Laptop) till the existing ticket is Closed/Cancelled.

 

Hosting Type: Data Center

We use plug-ins like Script Runner, JSU, JMWE.

 

Please suggest a way to achieve this.

 

Thanks in advance!

 

2 answers

1 accepted

1 vote
Answer accepted
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 16, 2022

Hi @Sriharsha 

what do you mean by "same request"? Do you mean an existing, open request (issue) of the same customer request type? Or any issue in the same project with the same Summary?

Assuming you mean the same request type, you can add a Scripted (Groovy) Validator with a script like:

jqlSearch( "project=${issue.projectkey} and \"Customer Request Type\" = \"${issue.get("Customer Request Type")?.name}\" and status not in (Closed,Cancelled)", 1).size() == 0
Sriharsha August 16, 2022

Hi @David Fischer ,

Thank you for the quick response!

Yes, you are correct. What I meant is an existing, open request of the same request type. 

And, also we need to take care of the Custom Field - "Hardware Item " which is a select list (single choice) of the same request type.

Ex - Laptop, Desktop, etc.

If an 'X' reporter raised a request with Hardware Item Called "Laptop" and the issue is still open. At this point of time, the same reporter 'X' cannot create a new request with same Hardware item called "Laptop".

Hope I'm clear.

Regards,

Sriharsha

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 21, 2022

Hi @Sriharsha ,

you can add that condition in your JQL expression:

jqlSearch( "project=${issue.projectkey} and \"Customer Request Type\" = \"${issue.get("Customer Request Type")?.name}\" and status not in (Closed,Cancelled) and \"Hardware Item\" = \"${issue.getAsString("Hardware Item"}\"", 1).size() == 0
Sriharsha August 23, 2022

Thank you, David!

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 23, 2022

You're welcome @Sriharsha 

Can you "Accept" the answer so that it can benefit our Community members?

1 vote
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 16, 2022

Hi @Sriharsha 

On the "on create" transition of your issue type you have to add a validator to check of any issuetype of the same request type of the same reporter exists. If that happens, then a message will appear on the customer (reporter). Of course you have to make sure that the check you perform is indeed the one you need and that it will not yield an error.

Alex 

Sriharsha August 16, 2022

Hi @Alex Koxaras _Relational_ , thank you for quick response!

Can you pls elaborate? 

 

Thank you!

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 16, 2022
  • Edit the workflow of your issuetype to which this request type is associated with.
  • Click the "diagram" and click the "on create" transition
  • On the popup to your right click validators
  • Click Add validator
  • Search and click for any groovy script of your liking (e.g. Scripted (Groovy) Validator (JMWE app))
  • Write your script validation (similar to this): issue.get("customfield_11151")?.name == "Get IT help" && issue.get("reporter")?.name == currentUser
  • Test your validation to see if it yields proper results
  • Write the error message which will appear to the user
  • Save the validator
  • Publish your workflow

groovy validator.png

Sriharsha August 16, 2022

Thank you so much, Alex!

 

Will keep you updated!

 

Regards,

Sriharsha

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 16, 2022

@Sriharsha I would do what @David Fischer said. It is the right way :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events