hi all,
I need to validate multiple custom fields in the transition and display appropriate message.
for suppose I have custom fields A,B,C,D.
If a user enters values for A,B and if he ignores C,D ,the message should display -"C,D are required fields" .
Or if user enters value only for A, the message should display - "B,C,D are required fields"
So, Can I customize the display message accordingly?
Can I achieve this with ScriptRunner? (jira cloud)
Hi Sahrudai,
Thank you for your question.
I can confirm that the ScriptRunner for Jira Cloud plugin provides workflow Validators using the Jira Expression Framework as documented in the Atlassian API documentation page located here or in the documentation page located here which explains how to add in a new validator to your workflow.
I can confirm that when viewing the Jira Expression Framework API documentation page linked above you can navigate to the Context variables section which shows what variables are provided by this framework that can be used to create the expression.
If you then click on one of the variables it will show all the properties that can be called on the variable for the expression such as for the issue variable as shown here.
You will be able to use the issue variable to validate that certain custom fields have values entered inside of them and when creating the validator you can specify the custom error message as stated in the documentation page linked above which contains the steps on how to add a validator.
I can also confirm we have some examples of validators that can be used as a reference guide in the page located here as well as in the documentation page located here.
I would recommend using these documentation pages linked above as a reference guide to help to create the validator expression that you require.
Regards,
Kristian
Hi Kristian,
Thanks for the reply.
I tried as you said, then it will validate the custom fields before the transition if it is populated.
I need to make the custom fields mandatory in transition and validate if they all are populated in the transition screen and display a message like I said above(for which custom fields values are not given and the error message should display accordingly).
So, In one go, I need to validate the Custom fields in the transition screen and display all the fields which are 'required' in the error message if they are not given any values(not populated).Because as of now, the error message will only show for one field at a time.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sahrudi,
I can confirm that it is possible to use validators with Transition screens as long as the fields you are validating are on the transition screen.
Please note however it is only possible to show the error message below one field and to show them one at a time due to the way that the validators functionality is designed inside of ScriptRunner for Jira Cloud.
This means that it is not possible inside of Jira Cloud to show one single error message at the top of the transition screen which shows all required fields at the same time.
Regards,
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.