web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

How to change user id of current user on runtime in business central

(0) ShareShare
ReportReport
Posted on by 241

Hello experts,

Hope you're all doing well. 

I've a function "MyFunction(UserId: Code[50])" in a codeunit which further calls a system's function. In that system's function, code runs according to the current user that is currently logged in the business central. In 'MyFunction', I want to run that system's code according to the user I'm passing as a parameter.

In Finance and Operations, there is a method 'RunAs' which runs the code according to the user provided in the method 'RunAs'. Is there any way to perform this functionality in Business central? Answers will be highly appreciated. Thanks for reading.

I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    61,005 Super User 2025 Season 2 on at

    that sounds like a great idea but I didnt know anything available in BC as of today.

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,111 Moderator on at

    There is no such function in Business Central.

    But in Business Central you can assign permission to an object and that will allow users to run functions in the context of the object even though they will not be able to perform the same actions independently in the user interface.

  • Suggested answer
    YUN ZHU Profile Picture
    95,712 Super User 2025 Season 2 on at

    Hi, Unfortunately, as far as I know, this feature is not available in BC.

    There is a clue, although I have not investigated in detail.
    In Job Queue, Codeunit or Report is executed using the User ID set on the card. I am not sure whether this can be used in our customization.

    pastedimage1643763275410v1.png

    Hope this will help.

    Thanks.

    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,606

#2
YUN ZHU Profile Picture

YUN ZHU 931 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 773 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans