Ayesh Nipun
Ayesh Nipun

Reputation: 614

How to generate Display Name with Given name and Surname, in azure B2C built-in policies?

I'm using the azure b2c sign-up policy(built-in policy) in my application. There, we are having three fields.

  1. Display Name (Basically this is equal to Given name + Surname)
  2. Given Name
  3. Surname

In my case, I want to remove this Display name from the user flow. But once I remove it, In B2C, the name of the user is "Undefined".

Is there any way that I can generate the Display name with Given name and Surname, Without asking the Display name?

(I'm using built-in user flow)

Upvotes: 5

Views: 3070

Answers (1)

Raghavendra beldona
Raghavendra beldona

Reputation: 2102

Concatenating the claims in the Built-in user flow is not possibile. It can be possibile using the custom policy

<ClaimsTransformation Id="CreateDisplayNameFromFirstNameAndLastName" TransformationMethod="FormatStringMultipleClaims">
  <InputClaims>
    <InputClaim ClaimTypeReferenceId="givenName" TransformationClaimType="inputClaim1" />
    <InputClaim ClaimTypeReferenceId="surName" TransformationClaimType="inputClaim2" />
  </InputClaims>
  <InputParameters>
    <InputParameter Id="stringFormat" DataType="string" Value="{0} {1}" />
  </InputParameters>
  <OutputClaims>
    <OutputClaim ClaimTypeReferenceId="displayName" TransformationClaimType="outputClaim" />
  </OutputClaims>
</ClaimsTransformation >

Please refer this document for more information.

If you are specifically looking for a way with Built-in user flow we would recommend you to do the concatenation in the application while showing the display Name. We would recommend you to use the display name than concatenating first name and surname(last name) because based on the IDP choosen by the customer may or maynot contain both First name and lastname(surname), Where displayname(Name) will be present

Upvotes: 5

Related Questions