Hi Stephen,
I want to block transition when my custom field( Radio Button id is 14403) value is "No" I want a transition to happen only when a custom field value is "Yes".
Can you please help me where I am going wrong with my script? Many thanks
Here is the script I am using.
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customfield = customFieldManager.getCustomFieldObject("customfield_14403")
if (issue.getCustomFieldValue(customfield) == 'Yes') {
return false
} else {
return true
}
Thanks,
Raj
Hi Raj,
You will need a Simple scripted validator and your script should look something like
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.option.LazyLoadedOption
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customfield = customFieldManager.getCustomFieldObjects(issue).findByName("RadioButtons")
def selectedValue = issue.getCustomFieldValue(customfield) as LazyLoadedOption
selectedValue.value == "Yes"
Hi @Thanos Batagiannis _Adaptavist_ ,
I am Getting below mentioned error on the transition before the required transition where exactly validator is placed.
I am also attaching the workflow for your reference.
In the workflow the validation should happen on "Completed" at status Pending Application Access" But it throws the below given workflow error when I click on "Approve" Transition. Can you please help fix this problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not sure where you placed the validator
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Thanos Batagiannis _Adaptavist_ ,
I have placed it on completed transition between Pending Application Access and Pending Task Completion status.
As I wanted validation to happen when I click on completed transition and block the transition if the custom field value is "NO"
Thanks,
Raj
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.