Passing field from Sales Header to Posted Invoice Header

dougshepard3dougshepard3 Member Posts: 8
A while back we created a field called "Created by" on the Sales Header table in the 50000 range. I recently created a field of the same name in the Sales Invoice Header table. In our test environment I posted a Sales Order. The value in the "Created by" field didn't pass over. I was once told by a NAV consultant that if the field names match between document tables and posted tables, the value will pass through during posting. I thought I had confirmed this at my old company on 3.7, but it's not working on 5.0 at my new company.

Can someone please advise me on this... should it be passing through? If not, what's the cleanest way to accomplish this (I imagine I have to modify a Codeunit)...

Thanks

-Doug

Comments

  • SavatageSavatage Member Posts: 7,142
    I've always made sure that "Not" just the name was the same but the number too, as well as it's size & type.

    So if I had "Created by" field # 50083 in sales header i would also use 50083 in posted sales invoice & Posted Shipment Header too.
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    The function TRANSFERFIELDS is used to transfer the fields from Table1 to Table2.

    From the on-line help:
    TRANSFERFIELDS copies fields based on the Field No. property of the fields. For each field in Record (the destination), the contents of the field with the same Field No. in FromRecord (the source) will be copied, if such a field exists.

    The fields must have the same data type for the copying to succeed (text and code are convertible, other types are not.) There must be room for the actual length of the contents of the field to be copied in the field to which it is to be copied. If any of these conditions are not fulfilled, a run-time error will occur.
    The field numbers must match in the two tables, and the field types and length must be the same as well.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • garakgarak Member Posts: 3,263
    Give the fields in Table 36 and table 110 (Sales Shipment Header), 112 (Sales Invoice Header), 114 (Sales Cr.Memo Header) and 6660 (Return Receipt Header) the same "Field No." and the same "Data Type".

    Then u must nothing more change. In the CU 80 is a transferfield used to transfer the fields from the header to the posted header. So, you need no code modifications. If you doesn't need the field in the tables 110,114 and 6660 and only in tabe 112, you should let this "Field No." free in these table to avoid problems in the future (like the transferfield can't work because there is a Data Type problem (Text to int for example).

    A tip: If u use the "Archive" for the Sales Documents (Order, Quote) u should also copy this field there. So, if you restore a archived document, this field is also stored and restored.

    Regards
    Do you make it right, it works too!
  • dougshepard3dougshepard3 Member Posts: 8
    I had intended to make the field in table 112 the same number (I "thought" it had to be, but I wasn't sure) but I made it 50120 instead of 50020... so that was the problem. Thanks for the help!
  • garakgarak Member Posts: 3,263
    You're welcome
    Do you make it right, it works too!
Sign In or Register to comment.