Hi, I am trying to execute an process. I want to check if the result value is null take task1 if not null want to end the process. Please advice.
Flowable process xml
targetRef=“paramValGateWayError”>
</sequenceFlow> <sequenceFlow id="flow7" sourceRef="paramValGateWayError" targetRef="servicetask2"> <conditionExpression xsi:type="tFormalExpression">${validationError != null}</conditionExpression> </sequenceFlow> <sequenceFlow id="flow10" sourceRef="paramValGateWayError" targetRef="endevent3"> <conditionExpression xsi:type="tFormalExpression">${validationError == null}</conditionExpression> </sequenceFlow> <endEvent id="endevent3" name="End"></endEvent>
code snippet written in kotlin
fun checkForValidOperation(map: Map<String, Any>): CustomGraphQLException? {
if (!map.containsKey("checkParam") || !map.containsKey("validationKey")) { throw Exception("Arguement are not properly configured") } if (!(map.get("checkParam") is String) || !(map.get("validationKey") is String)) { throw Exception("Invalid parameter") } val chkParam = (map.get("checkParam") as String).split(",") val checkKey = (map.get("validationKey") as String).split(",") val lst = mutableListOf<GraphQLErrorAttribute>() checkKey.forEachIndexed() { index, element -> when (element) { "email" -> if (!isValidEmail((map.get(chkParam[index])) as String)) { lst.add(ErrorAttribute(1001, "Invalid email format", chkParam[index])) } "number" -> if (!isValidNumber((map.get(chkParam[index])) as String)) { println("is Valid Numer check is addressed") lst.add(ErrorAttribute(1002, "Invalid number format", chkParam[index])) } else -> throw Exception("Parameter for check in not available") // unreachable for safety } } if (lst.isNotEmpty()) { println("throwing error") return CustomException("Parameter Validation Exception", lst) } return null }
one more doubt do I need to set the variable in DelegateExecution or shall as return such that flowable will add to the result variable.
Is there any option to check if the result is instance of ( ie I need to check if the result value is instance of Error Object or String Object ). Please advise on this
Please provide me a sample snippet on this case.
Thanks,