Adding new field in 'Value entry' table, to sync the data from customer table, territory code.

Hi Everyone,[NAV 2009 R2]

I am trying to sync data of the field "Territory code" from customer card to the new field(Custom field) in "Value entry" table. I have written below code in new field on validate trigger, but after posting sales order; my new field is not getting update in Value entry table.

New field- onValidate trigger()

IF "Source Type" = "Source Type":: Customer THEN BEGIN
Cust.GET("Source No.");
"Territory Code" := Cust."Territory Code";
MODIFY;
END;

Please assist me, what i am doing mistake or what is the correct way to do for my requirement.

Thanks,
Mani.

Answers

  • krikikriki Member, Moderator Posts: 8,941
    The fields in the value entry table are filled up without using validate. You need to put your code in the posting codeunit that writes to this table. In this case : codeunit 22.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
    NAV TechDays 2020: 19 & 20 November 2020, Antwerp (Belgium)
  • ManiNavManiNav Member Posts: 100
    Hi Kriki,

    Thank you so much for your reply,
    I created flow-field in value entry table for the territory code of customer table, and data get synced.
    Based on your suggestion:-
    I checked codeunit:22 to write in value entry table, but i am not sure that where should i assign for territory code in new field of value entry table.

    Thanks alot...

    Regards,
    Mani.
  • krikikriki Member, Moderator Posts: 8,941
    In general, that kind of code is written just before the INSERT statement of that table. Same rule for all Ledger tables.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
    NAV TechDays 2020: 19 & 20 November 2020, Antwerp (Belgium)
  • krikikriki Member, Moderator Posts: 8,941
    But also a flowfield can serve the purpose. What is better? It depends. If you need to read or filter on that field, it is better a real field for performance.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
    NAV TechDays 2020: 19 & 20 November 2020, Antwerp (Belgium)
  • kvbkvb Member Posts: 102
    Whatever your business goal with this territory field, I believe you can use dimensions for that.
Sign In or Register to comment.