Validate True/False attribute value in workflow
Hi,
We are working on a workflow wherein we have to execute a logic task based on if the value of a specified attribute is True/False. However, the below code does not seem to execute; hoping I can get some pointers on this forum:
for (col in columns) {
List AttributeList = attributeApi.findAttributes(FindAttributesRequest.builder()
.assetId(col)
.typeIds([string2Uuid(‘b1db2d63-dec4-4d9e-a25c-5f140b45d932’)])
.build())
.getResults()
if(AttributeList.get(0)==“false”) {
FalseCheck = true;
}
}
Issue: the code does not validate for when an attribute value in AttributeList is ‘false’
Note: Attribute Type is of kind ‘True/False’, we need to check if the attribute value = false
shivamsharma
2 comments
shivamsharma
OPThank you Pranay but unfortunately that didn’t work as well. I realized that the issue is AttributeList contains results from the find attributes api. We first need to extract the attribute value from the results; below worked for me:
if (AttributeList.get(0).getValueAsString() == “false”)
pmahend3
Hi Shivam,
If the attribute can only take in a boolean value, you should be able to simplify the condition to
if(!AttributeList.get(0)) {
FalseCheck = true;
}