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

Community site session details

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

How to automatically populate a Salesperson Code based on the current user

(1) ShareShare
ReportReport
Posted on by 160
Hello,
I am trying to develop code to automatically populate a salesperson code based on the signed in user.
We can make use of SystemCreatedBy field in business central as it is present as a base functionality in there.
 
CalcFormula = lookup(User./User Name/ where(/User Security ID/ = field(SystemCreatedBy)));
 
i am thinking of linking this to Salespeople/purchaser table . To get the exact Salesperson code I was thinking of using email field from this table to get the current logged in user. 
But unable to figure how to like these two now.
Your help will be much appreciated
 
 
 
I have the same question (0)
  • Suggested answer
    tanya07 Profile Picture
    1,638 on at
    How to automatically populate a Salesperson Code based on the current user
    Hello,
     
    Where do you want to populate the sales person code , which page? 
  • Suggested answer
    Mohana Yadav Profile Picture
    60,977 Super User 2025 Season 2 on at
    How to automatically populate a Salesperson Code based on the current user
    You can use User Setup for the mapping.
    You can filter the current user using the USERID on the user setup and then assign Salesperson/Purchaser Code field to destination table/field.
     
  • Suggested answer
    YUN ZHU Profile Picture
    93,808 Super User 2025 Season 2 on at
    How to automatically populate a Salesperson Code based on the current user
    Hi, as far as I know, this can't be done if you want to use Flowfield. Because Flowfield cannot refer to another Flowfield.
    More details:
    Dynamics 365 Business Central: A flow field is part of the query column list, this is not supported (Flowfield based on Flowfield)
     
    You need to create a variable, then query the value and insert it when the page is opened. As for whether you use Email association or User Setup association is fine.
     
     
    PS: Dynamics 365 Business Central: How to display User Name from SystemCreatedBy/SystemModifiedBy field on the page (Translate a user security ID GUID to the corresponding user name)
     
     
    Hope this helps.
    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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
Sumit Singh Profile Picture

Sumit Singh 2,163

#2
OussamaSabbouh Profile Picture

OussamaSabbouh 1,908

#3
YUN ZHU Profile Picture

YUN ZHU 1,878 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans