TRANSFERFIELDS not working

jhanvincent14jhanvincent14 Posts: 150Member
edited 2018-09-14 in NAV Three Tier
toz5836fgx94.png

Hello, Everyone!

Good day. if you can see in my attached photo, Codeunit 6620 is using transferfield function to get Posted Sales Invoice to Sales Return Order (Sales Invoice Header to Sales Header). It should transfer the values, but sadly, the field Salesperson Code and External Document No. from Sales Invoice Header to Sales header is has not been transferred. does anyone have an idea on what's happening here ? thanks in advance

Answers

  • swpoloswpolo Posts: 59Member
    Hi.
    TRANSFERFIELDS transfers field values according to their IDs (not names). Possibly in your database these fields have not sames IDs in correspondet tables. Possibly customizations are related to these fields.


    Nav Upgrades and DEV outsourcing
    Hire dev team for your project
    swp-group.com
  • Slawek_GuzekSlawek_Guzek Posts: 1,516Member
    Have you put the debugger on and checked the variables state right after executing the FromSalesHeader.TRANSFERFIELDS(FromSalesInvHeader) line?

    Have you seen that the fields Salesperson Code and External Document No. have values in FromSalesInvHeader, but are blank in FromSalesHeader record right after executing TRANSFERFIELDS? If not how can you be so sure that the TRANSFERFIELDS is not working?
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • jhanvincent14jhanvincent14 Posts: 150Member
    swpolo wrote: »
    Hi.
    TRANSFERFIELDS transfers field values according to their IDs (not names). Possibly in your database these fields have not sames IDs in correspondet tables. Possibly customizations are related to these fields.


    Hi @swpolo

    thanks for the quick response. Yes, it has the same ID No. but still not working
  • jhanvincent14jhanvincent14 Posts: 150Member
    Have you put the debugger on and checked the variables state right after executing the FromSalesHeader.TRANSFERFIELDS(FromSalesInvHeader) line?

    Have you seen that the fields Salesperson Code and External Document No. have values in FromSalesInvHeader, but are blank in FromSalesHeader record right after executing TRANSFERFIELDS? If not how can you be so sure that the TRANSFERFIELDS is not working?

    Hi @Slawek_Guzek. Thank you for the response, Salesperson Code and External Document No. in FromSalesInvHeader has a value but after transferring the field to FromSalesHeader or after executing the transferfield, the Salesperson Code and External Document No. has no Value
  • Slawek_GuzekSlawek_Guzek Posts: 1,516Member
    I'm almost sure that you are doing something wrong when checking values in both tables.

    There is nothing specific about those fields. These are system fields, they do share IDs (43 for Salesperson Code and 100 for External Document No.) There is absolutely no reason why TRANSFERFIELDS would not transfer just those 2 field values, but would transfer all the remaining fields.

    TRANSFERFIELDS would not transfer values if the fields were disabled in one or another table. But since you can see some values in fields in Sales Invoice Header table (112) the fields are not disabled there. On the other hand Salesperson Code in Sales Header table (36) is used in quite few places and you would get errors when NAV tried to acces this field in code, so it is very unlikely they got disabled in Sales Header table table .

    The only other thing which comes to my mind is that you have two bespoke field in one table or another, which have the same captions as fields 43 for Salesperson Code and 100 for External Document No. (for example someone copied the fields into bespoke ID range, changed names but left captions unchanged). In such case yoo could see bespoke fields as Salesperson Code and External Document No. field in zoom or debugger, as you see field caption in both places, but of course TRANSFERFIELD would not of course transfer values between fields with different IDs.
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • RockWithNAVRockWithNAV Posts: 725Member
    It must be transferring but in some next processes or code execution it might be getting nullified, You need to debug it carefully.
Sign In or Register to comment.