Copy field from Purchase Header to Purchase Lines

After insert Purchase Header, I need that PurchaseHEader.“Buy-from Vendor No.” to be copy to Purchase Lines.“Buy-from Vendor No.”.

I tried in Document No. - OnValidate() on Purchase Lines but no results.

I tried in Type validate in Table Purchase Lines, but no Result

How can I Do It?

This is already done when the No. field is validated on the Purchase Line. Has this been removed?

You can’t copy it to the lines when a header is inserted because there aren’t any lines yet.

The problem is that I need the Purchase Lines.“Buy-from Vendor No.” fill, before No. field.

This is because I need to filter Item List by Vendor Nº. So. First I must Know witch is my vendor, and then look for my item list already filter by vendo.

Do you understand?

So when you click the Lookup arrow you want to filter that list based on the vendor number. The issue arises because a record has not been inserted yet and you’re not calling any function in the table to fill that data out.

Since the item lookup is handled by a TableRelation property, you’ll need to override that by writing your own code in the OnLookup trigger. You’ll have to account for every type, though, that is Items, G/L Accounts, Resources, Item Charges.

I’d just perform the check after they select the number, personally. My guess is that the user will be typing / searching for the number they want anyway, so it wouldn’t matter much if the list was pre-filtered or not.