how to compare a flow variable holding some string value to another string value in condition in faultrule

Not applicable

Hello All,

I have to execute a fault rule based upon a condition.

Condition is that : flow variable called failed.errorvalue is equal to "The Service is temporarily unavailable"

I'm able to get the string value "The Service is temporarily unavailable" in failed.errorvalue flow variable. But condition is failing if i place like below

<Condition>failed.errorvalue equals "The Service is temporarily unavailable"</Condition>

Solved Solved
0 5 1,789
1 ACCEPTED SOLUTION

Not applicable

@Anil,

Sure.

Initially i have placed the variable in {} in condition as we do it for variable reference in policies.

Later i have removed the {} , it resolved the issue.

View solution in original post

5 REPLIES 5

Hi @venkat ch,

Your code should work. There might be junk character in your string.

If you are applying the condition to the rule itself, you will be able to see the below information in the trace. Are you seeing Expression.result = false?

1690-capture-apg.jpg

Hello Subramanay,

Thanks. yes I'm getting ExpressionResult as false.

Please check the below

Actual output is, from below i'm taking output variable.

{ "fault": { "faultstring": "The Service is temporarily unavailable", "detail": { "errorcode": "messaging.adaptors.http.flow.ServiceUnavailable" } } }

Extract variable policy is

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<ExtractVariables async="false" continueOnError="false" enabled="true" name="jsonpayloadextract">

<DisplayName>jsonpayloadextract</DisplayName>

<FaultRules/> <Properties/>

<URIPath name="name"/> <QueryParam name="name"/>

<Header name="name"/> <FormParam name="name"/>

<Variable name="name"/>

<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>

<JSONPayload>

<Variable name="errorvalue" type="string">

<JSONPath>$.fault.faultstring</JSONPath>

</Variable>

</JSONPayload>

<VariablePrefix>failed</VariablePrefix>

<Source clearPayload="false">error</Source> </ExtractVariables>

it is extracting the value, i kept JSON policy to show the extracted value

context.getVariable('failed.errorvalue');

1692-valueerror.jpg

I'm not sure where junk character is coming.

Regards,

Ch.Venkat.

Hello Subramanaya,

Issue is resolved.

Regards,

Ch.Venkat

@venkat ch , Would you like to share the solution with community ? What was the issue exactly & how problem is solved ? I am sure it will be helpful for many others.

Not applicable

@Anil,

Sure.

Initially i have placed the variable in {} in condition as we do it for variable reference in policies.

Later i have removed the {} , it resolved the issue.