Table Relation

I added an User Name textbox on a form, but I don’t want the user to enter it manually, so, I set the Table Relation to “User Set Up” table and allow the users to pick it from the list. However, after the user pick the right selection, it only shows the User ID on the textbox, but not the User Name, how can I display the User Name, instead of User ID? Thanks.

Depends on what the purpose is for?

Navision is a Relationship, so your lookup to the User Table should really used the USER ID as this is the primary key and will enable you to GET the User Setup Record.

If you use the User Name instead then you are going to cause issues when you need to retrieve the User Setup record at a later date.

I would recommend 2 fields. One for the User ID and another for the User’s Name. Make the User name field uneditable, to ensure that the data stays consistant.

Then OnValidate of the field in your table do a

If UserSetup.get("User ID) then
“User Name” := UserSetup.Name
“User Name” := ‘’;

If you wanted to make sure that the “User Name” field stays consitant “at all times” with the User Setup table you could use a flowfield.
But standard Navision would not do this. Try it. Create a Sales Order, use a Customer, then go an change the name of the Customer on the customer card, go back and look at the Sales Order the Customer Name will not have changed.

So the short answer is you should be using User ID not User Name as this is the Primary Key/Foreign Key.


Sorry, I am pretty new at Navision, can you tell me where I could find OnValidate? I tried to open the C/AL code under the design view of the table, but it didn’t show anything? Thanks.

Hey Ilaw,

Open your table. Click on the field you want the code on and press F9.

This will open the C/AL Code Editor.

You should see two triggers

- OnValidate()
- OnLookup()

They will both be grey bars with the writting within


I tried it, but it doesn’t work, is it because of my license’s problem?

Hi ilaw,

it sounds like it might be a license issue. Are you an end user?


I gave you one of the possible solutions using a flowfield in mibuso. If you found what you need it would be helpful if you post “solved” somewhere so we know you got what you wanted.

try at textbox

and then you choose C/AL code

there you are…


Can you updated this post please? Is this still an issue?



No, the options(C/AL code F9) are grey out.

I found out it’s because I don’t have Developer’s license, that’s why this option is grey out.