Note : I don't want to make a field mandatory during a status transition , but when it is on a particular status .
For eg : Status = In Progress , Custom field is optional
Status = Pending , Custom field is mandatory
Hi Shivi,
A status transition and saying once a field moves into a particular status is the same thing.
You should put a Validator on the transition to the Pending status to make the field required.
I don't think its same ..
For E.g. : If from To Do -> In Progress , only user can move it and the issue assigned to is a developer , So he will be responsible to fill out that custom field which I want to make mandatory . If I put validator only that transition , user will be asked to fill out that mandatory field , while I want developer to fill that field .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's different information that what was in the question - thank you for the clarification.
How will you know if the user is a Developer?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @John Funk
User is a different role and Developer is different . The status transitions are restricted according to the user roles and permissions .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Since you already have different transitions, just put the validator on the one for Developers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you mean, once ticket transition is completed to Pending, if ticket is edited, certain custom field is mandarory due to status = Pending?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, if this is the case, I think you accomplish this with a Behaviour script.
You can read about them here
https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html
If I have a chance I will give you the idea of the script tomorrow
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here it is an example of Behaviour script
def cf_status = getFieldById("status")
def cf_field = getFieldByName("yourfieldName")
String status = cf_status.getValue()
if (status.equalsIgnoreCase("Pending")) {
cf_field.setRequired(true)
}
else {
cf_field.setRequired(false)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried this but it is not working . The field is not showing as mandatory when status is "Pending".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am using the same script which you have shared . Apologies for late reply !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Shivi Gupta
Sorry for the late.
Here it is the correct script.
In my example, I will do the Tester customfield mandatory only when ticket is in Accepted status.
This script was placed as a Behaviour script for the Tester customfield.
Behaviour initializer should be left empty.
def cf_field = getFieldByName("Tester")
String status = underlyingIssue.getStatus().name
if (status.equalsIgnoreCase("ACCEPTED")) {
cf_field.setRequired(true)
}
else {
cf_field.setRequired(false)
}
After saving the behavior, I just test the behavior trying to Edit a ticket. If ticket is in Accepted status, the field shows a red "*" to imply the field is mandatory. If ticket is in a different status, the red "*" is not shown and the field is not mandatory.
Please check on your side and let me know.
Regards,
Jose Luis
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.