Base solution for your next web application
Open Closed

Issue with entity with IMayHaveTenant for CreatorUserId and LastModifierUserId #8970


User avatar
0
razkhan78 created

Hi

We are using latest Asp.Net Core MVC with jQuery.

For one of our entities we need to allow host admin to select Tenant. We added Pick Control.

But when we save data with TenantId it stores CreatorUserId as Null and in update LastModifierUserId as Null. We have used using (UnitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant)) { await CreateOrEditData(input); }

How we can fix this?


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @razkhan78

    If entity belongs to a Tenant, you can't set CreatorUserId to a host user. Would you like to do that ?

  • User Avatar
    0
    razkhan78 created

    Entity is having IMayHaveTenat.

    We want our super admin/host admin to create some records for tenant. So yes entity belongs to Tenant but can be managed by Host Admin. And so if Host Admin made any change or created it for tenant, we need to know the correct UserId.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I suggest you to create a new table for this and store it on Host side. For example table can be like this;

    • CreatorUserId
    • ModifierUserId
    • RecordId
    • TenantId

    If you want to show this on a UI, you can also add a "Description" field. Note that, this entity shouldn't implement IMayHaveTenant interface.