Boolean in custom policy give invalid type error

Copper Contributor

I've created a custom policy where I defined following Claim:

<ClaimType Id="extension_eula">
        <DisplayName>Accept Eula</DisplayName>
        <DataType>boolean</DataType>
        <UserHelpText>Accept the EULA to proceed with the setup</UserHelpText>
        <UserInputType>RadioSingleSelect</UserInputType>
        <Restriction>
          <Enumeration Text="Yes" Value="True" SelectByDefault="false" />
        </Restriction>
</ClaimType>
 
When I click on the radio button to accept the EULA it gives me following error in Application Insights:
{
"Key": "Exception",
"Value": {
"Kind": "Handled",
"HResult": "80131500",
"Message": "An error occurred while writing User claims using identifier claim type \"signInNames.emailAddress\" in tenant \"o365testb2c.onmicrosoft.com\". Error returned was 400/Request_BadRequest: Invalid type for property 'extension_e3eeb4aa7a9f45a69369564e0996ea00_eula' specified. Expected type '[extension_e3eeb4aa7a9f45a69369564e0996ea00_eula, True]'.",
"Data": {
"IsPolicySpecificError": false,
"TenantId": "o365testb2c.onmicrosoft.com",
"PolicyId": "B2C_1A_SignUpSignInO365TestB2C"
},
"Exception": {
"Kind": "Handled",
"HResult": "80131509",
"Message": "The remote server returned an error: (400) Bad Request.",
"Data": {
"cpim_webResponse_string": "{\"odata.error\":{\"code\":\"Request_BadRequest\",\"message\":{\"lang\":\"en\",\"value\":\"Invalid type for property 'extension_e3eeb4aa7a9f45a69369564e0996ea00_eula' specified. Expected type '[extension_e3eeb4aa7a9f45a69369564e0996ea00_eula, True]'.\"},\"requestId\":\"6ee502cc-16c7-4c17-8ed1-5159bea5a4a8\",\"date\":\"2020-01-22T07:31:54\"}}"
}
}
}
}
Howerver I defined the value as "True"
When I change the type to string instead of boolean the solution works.
1 Reply

I had the same error caused by setting the wrong data type when creating the User attribute in the Azure portal (it was set to String not Boolean). Correcting this data type fixed the errors.