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 automatically populate a Salesperson Code based on the current user

(1) ShareShare
ReportReport
Posted on by 146
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
 
 
 
  • Suggested answer
    YUN ZHU Profile Picture
    79,380 Super User 2025 Season 1 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
  • Suggested answer
    Mohana Yadav Profile Picture
    60,199 Super User 2025 Season 1 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
    tanya07 Profile Picture
    1,636 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? 

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,280 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,038 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans