Hi,
We are facing an issue when we set the following condition on step in a shared flow :
<Step>
<Name>KVM-GetLoggingConfiguration</Name>
<Condition>currentstep.flowstate="PROXY_REQ_FLOW"</Condition>
</Step>
As you can see in the picture, the variable is empty and the step is not executed :
If we put a Javascript policy with context.getVariable("currentstep.flowstate"), the variable is not empty anymore and the conditionnal step is executed :
Do you have an idea about what we are doing wrong?
Thank you
This seems unusual to me. It looks like your shared flow is attached as a preproxy flow hook and that means that it will execute BEFORE any of your custom flow variables are set. I'm assuming you set `currentstep.flowstate` in the parent flow. It makes sense to me that when you attempt to use your custom flow variable(`currentstep.flowstate`) in a preproxy flow hook that it is actually blank. However, what is strange is that you include a JavaScript callout policy and then you are able to fetch the custom flow variable from your parent flow. Please provide all of the policies (or at least the policy that sets this custom flow variable) and all flows so we can see where the policies are attached. Also include your JavaScript policy as well, unless it is just the one line of context.getVariable("currentstep.flowstate").
Sorry I forgot to mention that we actually attached this shared flow to a preproxy flow hook. We're not trying to get some "custom flow variable", unless you tell me that currentstep.flowstate is actually some custom variable. In this case, we would need the actual variable to test.
Our use case is a logging shared flow that we attach to preproxy, pretarget and posttarget hooks (and not postproxy since we cannot attach it to a postclient hook, but this is another topic). We build some json accross all of those hooks and we use it in the postclientflow. We have to know if it's the first time we come into this shared flow for this request and we thought currentstep.flowstate could do the trick.
Anyway, to reproduce, simply create a javascript policy with this oneline context.getVariable("currentstep.flowstate") and attach it to the preproxy flow hook to reproduce the issue.
The variable currentstate.flowstate is not documented in our flow variables list, therefore I would avoid using that unless absolutely necessary. All flow variables are documented here. There is a flow variable named current.flow.name and I would suggest that you use that variable instead. Now when the preproxy flow hook executes, it occurs before any flow has started, so the value of this variable is blank. That would tell you that this is the first time your shared flow executes, so your condition could be <Condition>current.flow.name is null</Condition>. When subsequent flow hooks execute, that flow variable will be populated with the current flow name (preflow or postflow).
Alternatively, you could define and set your own flow variable in an Assign Message policy attached to the Preflow and then check the value in the flow hook's condition. If your flow variable is null, then execute your policies because this is the first time that Shared Flow is called.
<Condition>mycorp.variable is null</Condition>
Or you could define a new flow hook and attach that to the preproxy flow hook and have it execute the policies you listed above. Meaning that your post-proxy, pretarget and post-target flow hooks would have the same shared flow attached and your pretarget flow hook would have a different shared flow attached.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |