Hi, I am trying to create a workflow transition validation
I need to check that custom field "Escalated case number" starts with a partial word, for example, "SER-" or "AT-".
I tried it with:
cfValues['Escalated case number'] ~ "SER-"
But it doesn't work. Someone know how can I make it?
Thanks
Hi,
You could use
cfValues['Escalated case number'] ~ "SER-*"
Or write a custom groovy script since you are running script runner.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh I see, you need to use a groovy script here. You can use this one, just change the custom field id :
import com.opensymphony.workflow.InvalidInputException
import com.atlassian.jira.component.ComponentAccessor
//Jira User picker ID
int caseNumberId = 10100
def cfCaseNumber = customFieldManager.getCustomFieldObject(caseNumberId)
def cfCaseNumberValue = issue.getCustomFieldValue(cfCaseNumber)
if (!cfCaseNumberValue.startsWith("SER-"){
invalidInputException = new InvalidInputException("The Escalated case number is not correct. It should start with SER-")
throw invalidInputException
}
Antoine
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.
Do not worry about these warnings, since it is groovy it will evaluate on execution and work fine.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just to clarify I'm adding this script as a validator on workflow transition
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is exactly what this script is aiming at. :)
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.
Glad to help ! You can mark the answer as accepted to lead other users with similar issues on this topic.
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.