How to populate Sales Line Table fields with Item Table data

trionaatrionaa Member Posts: 4
Hi All,

I have a pretty basic (i hope) question about linking table fields in Navision 3.7.

There are 2 fields in the Item table called 'Duty Code' and 'Tariff No.'
When a Sales order is being entered into the Sales Line table, the user picks the Item number from a list, and a number of fields are then autopopulated into the Sales Line table.
I'd like to have the Item's Duty Code and Tariff No. also be populated into the Sales Line table when an Item number is chosen.
I've created 'Duty Code' and 'Tariff No.' fields in the Sales Line table, but don't know how to link them to the corresponding fields in the Item table, such that they get autopopulated when an Item number is chosen.

Can someone help me out please?!

Thanks,
Caitríona

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Welcome to Mibuso :)

    First, are you a technical person?

    if yes, what did you try so far?
    As you said when you select Item no. from list number of fields are populated..it will work if you write below them :thumbsup:
  • trionaatrionaa Member Posts: 4
    Hi, thanks for responding :D

    I'm not all that technical - I have some exp with Access and SQL Server but very little knowledge of how Navision works and how tables/fields link together.

    So far, I've been trying to get the 'Duty Code' link working by
    1. Creating a 'Duty Code' field in the Sales Line table and adding it to the Sales Line form
    2. Editing the 'Item List' which opens when you click in the No. field in the Sales Line form to include 'Duty Code' from the Items table
    3. Tried editing the Table Relation property of my new Sales Line 'Duty Code' to link to Items 'Duty Code' but it didn't seem to make a difference.
    That's as far as i've gotten unfortunately...hope i'm explaining this OK.

    Thanks,
    Caitríona
  • matttraxmatttrax Member Posts: 2,309
    You need to write code for this, which your license probably does not allow you to do (it sounds like you are an end user). When you enter a value into a field it called a function of that field called Validate. This makes sure that it is a valid value and does any additional checking that is necessary.

    I would start by reading up on the development material that is available on CustomerSource. However if your license does not allow you to view the code (View --> C/AL code) behind the table you might as well just go ahead and get your NAV partner involved.
  • SavatageSavatage Member Posts: 7,142
    As matt says you'll have to get to the code on the sales line table. you'll need a dev license to do it.

    As described here:
    viewtopic.php?f=23&t=46972

    Someone else asked how to populate the Item."Vendor No." to the sales lne table.
    so instead of "Vendor No." := Item."Vendor No.";

    You would have to change it to
    "Duty Code" := Item."Duty Code";
    "Tariff No." := Item."Tariff No.";
  • trionaatrionaa Member Posts: 4
    Hi All,

    Thanks for the responses. As we don't have a dev license it looks like I'll have to contact our NAV partner.

    One final question before I do though....the background to my issue is that we need to display the 'Duty Code' and 'Tariff No.' for each Item listed on a Sales Order Ack. We don't necessarily need to store this data in the Sales Line table, we just need to pull it from the Items table when the Order Ack is generated. Could I accomodate this through the Order Ack report's design (I've access to the code behind reports)?

    Thanks again,
    Caitríona
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    What is the ID of the report?

    I guess you can modify the reports..
  • SogSog Member Posts: 1,023
    Yes you can,
    Depending on how you want to do it, you can just fetch the item when the salesline type = item.
    be mindful, if the type is not item, you either have to clear the variables that show on the report. (if you use directly the itemrec, then clear the record.
    Or skip the output.
    The onaftergetrecord trigger is the trigger you ought to focus on, this will grant you acces to the current salesline that might be printed.

    A little more step by step can be requested, but I guess you'll learn more if you figure it out :)
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
Sign In or Register to comment.