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: 9,115
    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!


  • ManiNavManiNav Member Posts: 120
    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: 9,115
    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!


  • krikikriki Member, Moderator Posts: 9,115
    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!


  • kvbkvb Member Posts: 107
    Whatever your business goal with this territory field, I believe you can use dimensions for that.
  • RockWithNAVRockWithNAV Member Posts: 1,139
    Flow Fields are not recommended normally keeping performance in mind.
    Dimension could be one of the Option provided you have significant amount of knowledge how Global and Shortcut Dimension works.
Sign In or Register to comment.