Custom field checkbox "Merge" set to have only one value "Yes". So, practically when checkbox is not set to yes, then it does not show on story.
I need to set filter to when checkbox is not equal to "Yes"
I tried
if( it.toString() != "Yes")
if( it.toString().empty)
if( it.toString() != "")
if( it.toString() != null)
if (it.toString().trim().length() == 0)
Nothing works. Does anyone have a suggestion?
This works fine with filter set to Merge=Yes.
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Merge");
def checkBoxValue = issue.getCustomFieldValue(customField)
checkBoxValue.each
if( it.toString() == "Yes")
Thank you
getCustomFieldValue on a checkbox field returns an array of options.
You can check that with:
def customField = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Merge")
def checkBoxValue = issue.getCustomFieldValue(customField)
log.info "checkboxValue is of type ${checkBodValue.getClass()}"
So to know if "Yes" is checked or not try this:
def customField = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Merge")
def checkBoxValue = issue.getCustomFieldValue(customField)
def yesIsChecked = checBoxValue.any{it.value == 'Yes'} //will be True or False
Thank you. I made change, but it still does not work. could you please suggest?
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Incremental Dev Merge");
def checkBoxValue = issue.getCustomFieldValue(customField)
checkBoxValue.each
{
log.warn "================check box: "+it.toString()
log.warn("================issueLink.issueLinkType.name: "+issueLink.issueLinkType.name)
def yesIsChecked = checkBoxValue.any{it.toString() == 'Yes'}
if(issueLink.issueLinkType.name == "Epic-Story Link" && issue.getIssueType().name == "Story" && yesIsChecked == false)
{
def currentValue = epicissue.getAffectedVersions()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you post your full code in a properly formatted code block? At the very least, there is a missing closing }. It's hard to know what else might be missing.
But at first glance ... "it.toString()" should be "it.value" or "it.getValue()"
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Incremental Dev Merge");
def checkBoxValue = issue.getCustomFieldValue(customField)
checkBoxValue.each {
log.warn "================check box: $it.value"
log.warn("================issueLink.issueLinkType.name $issueLink.issueLinkType.name")
}
def yesIsChecked = checkBoxValue.any{it.value == 'Yes'}
if(issueLink.issueLinkType.name == "Epic-Story Link" && issue.issueType.name == "Story" && !yesIsChecked)
{
def currentValue = epicissue.getAffectedVersions()
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, that works. :)
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.
Thank you, I tried it, but for some reason it does not work.
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.