Options

NAV 2009 R2 RTC - Default Transfer Order Location

mib_usr_vaomib_usr_vao Member Posts: 12
edited 2013-12-24 in NAV Three Tier
Dear all,

I am trying to to set default Transfer-from and Transfer-to Locations on the Transfer Order Card on New Page or New Record; I also want to validate these values.

What I have tried so far is to add Transfer-from and Transfer-to lookup (to Location table) fields in the User Setup table, hence pointing each user to his/her default location. Then, I have written

vUserSetup.RESET; //introduced the User Setup table as a variable
vUserSetup.SETFILTER(vUserSetup."User ID",'%1',USERID);
IF vUserSetup.FINDFIRST THEN BEGIN
"Transfer-from Code":=vUserSetup."Transfer Location-from";
VALIDATE("Transfer-from Code",vUserSetup."Transfer Location-from");
END;

The code was entered either OnInsert() of the Transfer Header table or the Transfer Order page. In the first case I get an "Transfer Header No. 'XXXX' does not exist" error, in the second I get the value inserted by with no validation.

Any help is really welcomed, thank you very much in advance

Comments

  • Options
    geordiegeordie Member Posts: 655
    You can reduce your code as follow, customizing only the table (no need to touch the page):
    IF vUserSetup.GET(USERID) THEN
      VALIDATE("Transfer-from Code",vUserSetup."Transfer Location-from");
    

    Can you please ensure you added your code at the end of OnInsert table trigger, after this 2 statements?
    InitRecord;
    VALIDATE("Shipment Date",WORKDATE);
    
Sign In or Register to comment.