Fetching variable from assign message policy into Pre flow condition of Raise Fault Policy.

Hi everyone,

I am trying to get a variable value from "assign message policy" to pre flow condition of Raise Fault Policy.

JS.js

var str="abc"; 
var result=false; 
if(str==="abc"){ 
context.setVariable("result",true); 
}

Assign Message

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="AM">
    <DisplayName>AM</DisplayName>
    <AssignVariable>
        <Name>Output</Name>
        <Ref>result</Ref>
        <!-- refer to previously set var -->
    </AssignVariable>
</AssignMessage>

Raise Fault

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RaiseFault async="false" continueOnError="false" enabled="true" name="RF">
    <DisplayName>RF</DisplayName>
    <Properties/>
    <FaultResponse>
        <Set>
            <Headers/>
            <Payload contentType="text/plain"/>
            <StatusCode>400</StatusCode>
            <ReasonPhrase>Bad Request</ReasonPhrase>
        </Set>
    </FaultResponse>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</RaiseFault>

PreFlow

<ProxyEndpoint name="default">
    <PreFlow name="PreFlow">
        <Request>
            <Step>
                <Name>JS</Name>
            </Step>
            <Step>
                <Name>AM</Name>
            </Step>
            <Step>
                <Name>RF</Name>
                <condition>Output != true</condition>
            </Step>
        </Request>
        <Response/>
    </PreFlow>

But Fault is being raised even in the true condition.

Solved Solved
0 1 123
1 ACCEPTED SOLUTION

I found the mistake. The issue was with condition tag. The initial letter should be captial.

View solution in original post

1 REPLY 1

I found the mistake. The issue was with condition tag. The initial letter should be captial.