Hi.
I add simple validator, that need to check amount of attachments.
import com.atlassian.jira.component.ComponentAccessor
def cfm = ComponentAccessor.getCustomFieldManager()
try
{
def result = issue.getCustomFieldValue(cfm.getCustomFieldObject('customfield_10200')).value;
if(result.equals('Аварийная'))
{
log.error("заявка аварийная");
return true
}
else
{
if(issue.getAttachments().size()>=1)
{
log.error("заявка не аварийная, есть вложение. Заявка: " + issue.getKey());
return true
}
else
{
log.error("заявка не аварийная, нет вложений. Заявка: " + issue.getKey());
return false
}
}
}
catch(Exception e)
{
log.error("не получено значение поля Тип заявки");
return false
}
It is correctly defines the situation but successfully execute transition even validator need to return false.
What i am doing wrong?
I think that this is a workaround?
https://jamieechlin.atlassian.net/wiki/spaces/GRV/pages/1212434/Validators
To disallow the transition you set invalidInputException to an instance of a new InvalidInputException.
Yep it's work's, but i not sure that "Workflow error" is proper solution.
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.