UserID of who created the document when printing document

andy76andy76 Member Posts: 616
Good morning,

I would like to have on print of :
- sales order
- sales quote
- purchase order

the name of the user that has created them.
Isn'it possibile?

I saw that there is probably in posted documents (invoice and shipment).
But can I have also the full name and surname in some way or only the windows user intials?

Thank you

Andy

Comments

  • idiotidiot Member Posts: 651
    You need to capture the USERID by maybe creating a new field in the Sales Header & linking that field to the User table to retrieve the full name when printing the reports you mentioned
    NAV - Norton Anti Virus

    ERP Consultant (not just Navision) & Navision challenger
  • girish.joshigirish.joshi Member Posts: 407
    Idiot is right, you'll need a new field on the sales order etc to capture 'who created them'. Since those documents are working documents, and many users can contribute to them, you may want to consider if you need a modification that captures everyone who worked on the document.

    In order to print the first and last name of the user, you can link the USERID to the User Setup table.
  • SavatageSavatage Member Posts: 7,142
    You can do it like this for the User Name

    Add to Sales Header Globals
    User - Record - User

    Add a field on the Sales Header table
    Called "Created By" Type Text size 30

    On the OnInsert Trigger use
    User.GET(USERID);
    "Created By" := User.Name;
    

    Now add the field "Created By" to the Form &/or Reports.

    If you want just the code it's less work
    For Example you add a field to the Sales Header Table.
    Call it "Created By" type Code Size 20

    then on the OnInsert trigger of the Sales Header Table you add:
    "Created by" := USERID;
    

    That's it. if you add the field now to the Sales order Card you will see
    when you f3 to get a new # your Userid is now stored. Since it is stored in the table now you can put it on reports.
  • kinekine Member Posts: 12,562
    Do not forget, that if you use just table User to get the full name, it will not work when Windows Authentication is used. In this case you need to use the virtual tables accessing the AD for more info.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.