This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
conditions [2017/06/15 16:39] pawel |
conditions [2018/04/13 10:39] (current) root Added new condition |
||
|---|---|---|---|
| Line 9: | Line 9: | ||
| </ | </ | ||
| - | === Verify | + | === Only if Version 2.0 not in Fix Version field === |
| <code java> | <code java> | ||
| !(" | !(" | ||
| + | </ | ||
| + | |||
| + | === Only return true if we have " | ||
| + | |||
| + | <code java> | ||
| + | import com.atlassian.jira.component.ComponentAccessor | ||
| + | |||
| + | //Define Custom Field Manager | ||
| + | def cfm = ComponentAccessor.getCustomFieldManager() | ||
| + | //get field object | ||
| + | def cfApprovalStatus = cfm.getCustomFieldObjectByName(" | ||
| + | def cfApprovalStatusValue = issue.getCustomFieldValue(cfApprovalStatus) | ||
| + | //check if the field is equal to Awaiting Approval | ||
| + | if (cfApprovalStatusValue == " | ||
| + | //Returned true in comparison | ||
| + | return true | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | === Only allow transition if none of the values in custom fields are " | ||
| + | |||
| + | <code java> | ||
| + | import com.atlassian.jira.component.ComponentAccessor | ||
| + | |||
| + | //Define cfm | ||
| + | def cfm = ComponentAccessor.getCustomFieldManager() | ||
| + | //get field object | ||
| + | def cfFirstApprovalStatus = cfm.getCustomFieldObjectByName(" | ||
| + | def cfFirstApprovalStatusValue = issue.getCustomFieldValue(cfFirstApprovalStatus) | ||
| + | def cfSecondApprovalStatus = cfm.getCustomFieldObjectByName(" | ||
| + | def cfSecondApprovalStatusValue = issue.getCustomFieldValue(cfSecondApprovalStatus) | ||
| + | |||
| + | if ((cfFirstApprovalStatusValue != " | ||
| + | //Returned true in comparison | ||
| + | return true | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | === Allow only if user is member of role " | ||
| + | <code java> | ||
| + | import com.atlassian.jira.component.ComponentAccessor | ||
| + | |||
| + | def selectedMyField = cfValues[' | ||
| + | |||
| + | |||
| + | def userUtil = ComponentAccessor.getUserUtil() | ||
| + | |||
| + | isUserMemberOfRole(" | ||
| + | |||
| + | |||
| </ | </ | ||