Open Closed

how to add new data with CurrentUser on BackgroundJob #5901


User avatar
0
ElifKaya created

Hi,

We want to add new entry with BackgroundJob. We can achieve to change CurrentTenant and we add tenantId of entry to database. But, we can't set CreatorId to database with repository insert operation. Is there a solution to use for the current user like CurrentTenant.Change ? Thank you,

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info:

ABP Framework version: v7.3.1

UI Type: / MVC /

Database System: SQL Server,

Tiered (for MVC) or Auth Server Separated (for Angular): yes

Exception message and full stack trace:

Steps to reproduce the issue:


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

    hi

    You can set the CreatorId of the entity by ObjectHelper.TrySetProperty(entity, x => x.CreatorId, () => YourID);.

  • User Avatar
    0
    ElifKaya created

    I need to use it for child entity. So, I just wondered if there is CurrentUser change function like for tenant. Thank you for your advice, we will need to this in the future. But, I will add CreatorId as a parameter right now. Thanks,

Made with ❤️ on ABP v9.1.0-preview. Updated on November 01, 2024, 05:35