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

How to get values of proforma form before ticket is created? Form Validation with scriptrunner

koh January 17, 2022

I have a JSD form with the following:

1. "Users who need a PC" - Multiple User Picker, not linked to any field

2. "Users who need a user account" - Multiple User Picker, not linked to any field

3. "Approvers" - Multiple User Picker, Linked to JSD field "Approvers" in JSD workflow.

 

I want to ensure that 1 and 2 are not present in 3, i.e. the users making a request cannot be in the approvers list, and show an error message if this is the case, and prevent the user from submitting the issue.

 

It is not practical to link 1 and 2 because there are many user picker fields in proforma which involve creating a lot of custom fields. Anyway, linking the jira field only takes effect as an issue update event (i.e. issue is created with blank values, then values are synced) so it will not work for validation as well.

 

How can I achieve this validation?

 

I have scriptrunner, and I have read the proforma docs and I know how to get the form values from issue property. However, the docs describe the case where the ticket has already been submitted and there is an issue id (line 88). This use case will not work for me.

 

Thank you!!

1 answer

1 accepted

5 votes
Answer accepted
Callum Carlile _Automation Consultants_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 17, 2022

Hi @koh, I'm not entirely sure how the back-end of pro forma works but I do know that when you create a request, if you look in the history, the creation of the issue and the population of the Jira fields from the pro forma fields are separate events, which indicates that the fields aren't technically being populated on creation, but instead are being edited by the app as soon as the issue is created - which meets the 'issue update' event.

If you haven't tried already, I would try creating a scripted validator on the Create transition of your workflow to see if anything happens. If this doesn't work then you might want to consider building your logic within a listener, so that as soon as the task is created and the field values are populated the validation will run.

You could then add a comment/send a notification to let the user know that the task cannot proceed/transition the task to a (temporarily?) closed status, or however you wish to progress the task.

Sorry I'm unable to provide an exact solution as I have slightly limited knowledge of the app, but I hope this suggestion helps!

koh January 17, 2022

Hi @Callum Carlile _Automation Consultants_ ,

Thank you very much for your comment :) I will try out your suggestion.

It will be nice if there is a way to do simple validation for the proforma user picker as well e.g. to check if a user is in a particular group.

 

Cheers!!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events