conditions
This is an old revision of the document!
Scripted Conditions
Following scripts can be used for scripted conditions within the workflow
Only specific users will have access to this workflow step
currentUser.name in ["USERID1","USERID2"]
Only if Version 2.0 not in Fix Version field
!("Version 2.0" in issue.fixVersions*.name)
Only return true if we have "Awaiting Approval" in field Approval Stats and therefore display transition
import com.atlassian.jira.component.ComponentAccessor //Define Custom Field Manager def cfm = ComponentAccessor.getCustomFieldManager() //get field object def cfApprovalStatus = cfm.getCustomFieldObjectByName("Approval Status") def cfApprovalStatusValue = issue.getCustomFieldValue(cfApprovalStatus) //check if the field is equal to Awaiting Approval if (cfApprovalStatusValue == "Awaiting Approval"){ //Returned true in comparison return true }
only allow transition if none of the values in custom fields are "Awaiting Approval"
import com.atlassian.jira.component.ComponentAccessor //Define cfm def cfm = ComponentAccessor.getCustomFieldManager() //get field object def cfFirstApprovalStatus = cfm.getCustomFieldObjectByName("First Approval Status") def cfFirstApprovalStatusValue = issue.getCustomFieldValue(cfFirstApprovalStatus) def cfSecondApprovalStatus = cfm.getCustomFieldObjectByName("Second Approval Status") def cfSecondApprovalStatusValue = issue.getCustomFieldValue(cfSecondApprovalStatus) if ((cfFirstApprovalStatusValue != "Awaiting Approval")&&(cfSecondApprovalStatusValue != "Awaiting Approval"){ //Returned true in comparison return true }
conditions.1523534774.txt.gz · Last modified: (external edit)
