Access field from other page

TheHitman123TheHitman123 Member Posts: 12
edited 2014-05-13 in NAV Three Tier
I am a newbie trying to change NAV as follows:

Some of my users must be able to "Ship and Invoice" at all times except when a sales order is marked to restrict invoicing.
The changes I made was on the Sales Header I added a boolean to mark it as a "special" order. In these cases the system must not allow the user to ship and invoice, only to ship. A flag was added to User Setup as well to mark the users that should sometimes be restricted.

Then the idea was to test if the correct situation exists to block invoicing, the problem is however that once you click Post and Print it executes a codeunit and my license does not allow changing codeunits. I was therefore thinking of resetting the Qty to Invoice field to zero which will trigger NAV's validation on invoicing zero quantity. I was also thinking of putting the code for this on the page action to Post and Print directly in front of the code that calls the codeunit.

Being a newb, I do not know how to address the Qty to Invoice field at this point since it is in a different page part. (The sales lines).

Is there anyone who can help me with this code, basically once I tested for the correct situation which I know how to do, what code can reset the Qty to Invoice on all lines to zero.

Regards,

Comments

  • Wisa123Wisa123 Member Posts: 308
    Hey Hitman,

    First of all, i hope you dont want to apply this change to a productive System, because it's really, really, REALLY ugly.
    This should be changed in CU80 | CU81. I suppose you are some kind of student who doesnt have a DEV License. If not contact your NAV Partner for that change.

    However, if you really want to do this, some pseudocode may help you:
    SalesLine.Setrange(type, headertype);
    salesline.setrange(document no, headerno);
    
    if salesline.find('-') then repeat
     salesline.validate("qty. to invoice".0)
     salesline.modify(true);
    until salesline.next = 0;
    
    Austrian NAV/BC Dev
Sign In or Register to comment.