Options

Creating an Charge item order line automatically

harm.poelenharm.poelen Member Posts: 36
Hi There,

I 'm new at Navision programming (up to now only a lot of VB and such). I have a project in which I need to generate some Charge Item order entry line after a users has entered a item line. I have found that after entering a line for a Charge Item you will also need to create lines in the 'Item Charge Assignment (Sales)' table (5809).

My question is the following... does anybody have some code segements which is creating the order lines for Charge Items and then automatically links this created line to one or more order lines for Items.

I think that I will get it right eventually... but help is always appriciated.
CANE Microsoft Solutions BV
Prins Hendrikplein 14
2518 JC DEN HAAG
The Netherlands
http://www.cane.nl

Comments

  • Options
    ArhontisArhontis Member Posts: 667
    You are right about the "Item Charge Assignment (Sales)" table, it splits the quantity of the Charge to the items of the Sales Order.

    The best way to track what to do, is to activate the debugger, insert a charge item, follow the code and write down all that is done. In addition, you should see the "Item Charge Assignment" in the Line menu. That way you wont miss anything important.

    Then you could use the OnValidate of the 'No." field in the Line Record and when the "Type" is "Item" you execute your code.
  • Options
    DenSterDenSter Member Posts: 8,304
    If I may elaborate on that.... There's a few things that are very useful to know in Navision programming.

    One is what Arhontis is saying, that if you want to automate a manual process in Navision and oyu want to make sure you cover everything, turn on the debugger while you do it manually and track what it is doing.

    Another is you can make a recordvariable run its OnValidate code by validating the field instead of just setting it:
    // so you would do this:
    SalesLine.VALIDATE("No.",'MYNUMBER');
    
    // instead of this:
    SalesLine."No." := 'MYNUMBER';
    

    And finally, you can make a record variable run its OnInsert or OnModify code by sending TRUE into its parameter:
    SalesHeader.MODIFY(TRUE);
    SalesHeader.INSERT(TRUE);
    
    The default is FALSE, and by not running the code in the OnInsert/OnModify triggers, you run the risk of missing important code. If you want to only run parts of that code, you'll have to recreate it of course :) .
Sign In or Register to comment.