Auto-populate User ID when creating a Purchase Order

Hey,

Im quite new to NAV. Im trying to make the assigned user ID when creating a purchase order to automatically genrerate when a new purchase order is created (press F3). I can make it mandatory, but would like it be automatically created so the user doesn’t have to put it in or be able to change it.

Im guessing I need to make modifications to the OnInsert fucntion at the table level, but haven’t been able to pull the user ID successfully when creating a new purchase order

Thanks

You need to write code on OnInsert Trigger for populating USERID.

Read the post on following link:

http://dynamicsuser.net/forums/p/28610/151876.aspx#151876

Yes thanks I got that far, but it still doesn’t pull the user ID when a press F3 on Purchase Order :frowning:

I have added a field to Purchase Header called “Created By” and the code into OnInsert (this new field has no table relation, no sure if it should?)

I then added a new test box to the Purchase Order form called “Created By” with the source expression set to Rec → Field → “Created By”

Is there anything I might of missed?

Thanks in advance

Better to give Table relation User

in Oninsert trigger write

“Created By” := USERID;

It will get filled when record is inserted on after pressing F3 (Press F3 and TAB )