Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

Use userrec.username as a default Buyer value in PO Maintenance

(0) ShareShare
ReportReport
Posted on by 735

I want to know how I can use the value from the userrec.username field as the default Buyer value in the Other Information tab of PO Maintenance.  End users would like to have their username default as the Buyer rather than scroll through a PV list.  I'm sure it's an easy VBA customization but I'm not a VBA guy.  Appreciate any help.

*This post is locked for comments

  • Community Member Profile Picture
    on at
    Re: Re: Use userrec.username as a default Buyer value in PO Maintenance

    You may also want to put the above code in the buyer_Default()

  • Nayan Mansinha Profile Picture
    1,245 on at
    Re: Use userrec.username as a default Buyer value in PO Maintenance

    You can put this code in your Form1_Display() or other appropriate place:

        Dim CurrentUser As String
        Dim sql As String
        Dim CSR_UserRec As Integer, intFetchUserRec As Integer

        Call GetBufferValue("bpes.userid", CurrentUser)
        sql = "select * from userrec where username = " + SParm(Trim$(CurrentUser))
        Call SqlCursorEx(CSR_UserRec, NOLEVEL + SqlSystemDb, "CSR_UserRec", "userrec", "")
        intFetchUserRec = SqlFetch1(CSR_UserRec, sql, bUserRec, LenB(bUserRec))
        Call SqlFree(CSR_UserRec)
       
        serr1 = SetObjectValue("cBuyer", bUserRec.UserName)

    And make sure you import userrec.dh file your application\DB\DHFiles\Sys folder.

    HTH

     

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics

Product updates

Dynamics 365 release plans