Open Closed

Boolean ExtraProperty not Binding to EditModal #1884


User avatar
0
learnabp created

I have created a ExtraProperty for the User called "isActive"

ObjectExtensionManager.Instance.Modules()
    .ConfigureSaas(Saas =>
    {
        Saas.ConfigureTenant(tenant =>
        {
            tenant.AddOrUpdateProperty<bool>( //property type: string
                "isActive", //property name
                property =>
                {
                    //validation rules
                    property.Attributes.Add(new RequiredAttribute());
                    property.DefaultValue = true;
                    //...other configurations for this property
                }
            );
        });
    });

however this is not binding to the ui when i click edit i can see the isActive checkbox but the value is always true even when the isActive checkox doesn't have a tick mark


9 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    • ABP Framework version: vX.X.X
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    We have Tenant active/passive system (with blazor and mvc UI) in 4.4.x

  • User Avatar
    0
    learnabp created

    I am doing for user not tenant sorry the code is as follows

    and i am using 4.3.2

    ObjectExtensionManager.Instance.Modules()
    .ConfigureIdentity(identity =>
    {
        identity.ConfigureUser(user =>
        {
            user.AddOrUpdateProperty<bool>( 
                //property type: string
                "isActive", //property name
                property =>
                {
                    //validation rules
                    property.Attributes.Add(new RequiredAttribute());
                    property.DefaultValue = true;
                    //...other configurations for this property
                }
            );
    
        });
    });
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I can't reproduce the problem.

    Can you try this with a brand new project?

  • User Avatar
    0
    learnabp created

    It works for SaaS module which i have modified but doesn't work for the user module

    can we do a screen share i can show you!

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share a simple project? liming.ma@volosoft.com

  • User Avatar
    0
    learnabp created

    I found the issue its in the Update method of IndentityUserAppService

            await UpdateUserByInput(user, input);
            input.MapExtraPropertiesTo(user);
            (await UserManager.UpdateAsync(user)).CheckErrors();
            await CurrentUnitOfWork.SaveChangesAsync();
    

    the is not manpping from IdenityUserUpdateDto to IdentityUser hence i added to make modification from this

    input.MapExtraPropertiesTo(user);

    to

    input.MapExtraPropertiesTo(user, MappingPropertyDefinitionChecks.Source);

  • User Avatar
    0
    learnabp created

    Can you pleas elet me know if this is a BUG??

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    HI

    I can't reproduce the problem.

    Can you share a simple project that using template? liming.ma@volosoft.com

Made with ❤️ on ABP v9.1.0-preview. Updated on December 05, 2024, 12:19