“ANDing” Preconditions in Azure AD B2C
You often have this in a user journey:
<Preconditions>
<Precondition Type="ClaimEquals" ExecuteActionsIf="true">
<Value>Claim A</Value>
<Value>True</Value>
<Action>SkipThisOrchestrationStep</Action>
</Precondition>
<Precondition Type="ClaimEquals" ExecuteActionsIf="true">
<Value>Claim B</Value>
<Value>True</Value>
<Action>SkipThisOrchestrationStep</Action>
</Precondition>
</Preconditions>where Claims A & B are boolean.
These act as an “OR”, so if Claim A is True, Claim B is never evaluated.
But what if both have to be True?
Get Rory Braybrook’s stories in your inbox
Join Medium for free to get updates from this writer.
I came across this in this sample:
<!--Sample: Check if datetime comparison is true and also the PasswordResetOn
is presented in the user account.
If both of them are true, user doesn't need to reset the password-->
<ClaimsTransformation Id="CheckWhetherPasswordResetCanBeSkipped"
TransformationMethod="AndClaims">
<InputClaims>
<InputClaim ClaimTypeReferenceId="isPasswordResetOnGreaterThanNow"
TransformationClaimType="inputClaim1"/>
<InputClaim ClaimTypeReferenceId="isPasswordResetOnPresent"
TransformationClaimType="inputClaim2"/>
</InputClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="skipPasswordReset"
TransformationClaimType="outputClaim"/>
</OutputClaims>
</ClaimsTransformation>Effectively, you AND Claim A and Claim B, putting the result in Claim C.
Then you just need a precondition:
<Preconditions>
<Precondition Type="ClaimEquals" ExecuteActionsIf="true">
<Value>Claim C</Value>
<Value>True</Value>
<Action>SkipThisOrchestrationStep</Action>
</Precondition>
</Preconditions>which achieves the desired result.
And if you need three claims to be true, just AND the result with Claim D etc.
There is also an “OR” and a “NOT” as you can see here.
All good!










