I have a signup flow and it is working fine and it is multi-step:
- Contact details
- Verification
- Password
And now the flow is, after completing all steps a new user will get created, if the user name already exists then in the last step I'm getting an error message that the user already exists. Now I need to change this flow. After entering the contact details(email), I want to check whether this user exists or not. If it exists then I need to show the error message that shows in the last step in the first step itself and block the journey from moving to the next step.
To achieve this, what I did is:
Created a TP that reads the user details using email and put that as a validation technical profile for the first step:
<TechnicalProfile Id="AAD-CheckUserExist">
<Metadata>
<Item Key="Operation">Read</Item>
<Item Key="RaiseErrorIfClaimsPrincipalAlreadyExists">true</Item>
</Metadata>
<IncludeInSso>false</IncludeInSso>
<InputClaims>
<InputClaim ClaimTypeReferenceId="email" PartnerClaimType="signInNames.emailAddress" />
</InputClaims>
<OutputClaims>
<!-- Required claims -->
<OutputClaim ClaimTypeReferenceId="objectId" />
<OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="localAccountAuthentication" />
<!-- Optional claims -->
<OutputClaim ClaimTypeReferenceId="userPrincipalName" />
<OutputClaim ClaimTypeReferenceId="displayName" />
<OutputClaim ClaimTypeReferenceId="accountEnabled" />
<OutputClaim ClaimTypeReferenceId="otherMails" />
<OutputClaim ClaimTypeReferenceId="signInNames.emailAddress"/>
<OutputClaim ClaimTypeReferenceId="signInNames.phoneNumber"/>
<OutputClaim ClaimTypeReferenceId="givenName" />
<OutputClaim ClaimTypeReferenceId="surname" />
</OutputClaims>
<IncludeTechnicalProfile ReferenceId="AAD-Common" />
</TechnicalProfile>
And added <Item Key="RaiseErrorIfClaimsPrincipalAlreadyExists">true</Item>
to <Metadata>
.
Following is the validation profile section:
<ValidationTechnicalProfiles>
<ValidationTechnicalProfile ReferenceId="AAD-CheckUserExist" ContinueOnError="false"/>
</ValidationTechnicalProfiles>
But it is not working as expected, I tried with an existing user after clicking next on the first step it moves the verification step without any error.