How i can get no series of sales header table of one company into sales header of another company??

I am inserting sales header of Company A into sales header table of company B so I want to insert it with current document no series of company B's document not with document no of company A.

Answers

  • aceXaceX Member Posts: 166
    I suppose you are transfer the Documents using COMPANYCHANGE function. In this case I will recommend to check the No. Series for that document no as Manual so you will be able to insert and document no between other data.

    Regards
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    edited 2017-12-27
    If you work cross-company DO NOT use triggers.

    If you work in CompanyA and do RecA.CHANGECOMPANY('CompanyB') and then run Rec.VALIDATE(SomeField, 'SomeValue'), or Rec.INSERT(TRUE) then all the code executed inside trigger code, all the variables the trigger code will use, all of this will execute in the context of CompanyA, NOT in CompanyB.

    If you insert a record from Company A into Company B and you want to use serial number from company B you must code everying manually, without using any triggers, any standard codeunits/functions calls, and making sure to call CHANGECOMPANY on every variable table you will be using



    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • JuhlJuhl Member Posts: 724
    Don’t eat where you shit.., or how is the saying
    Follow me on my blog juhl.blog
  • allenyyzhouallenyyzhou Member Posts: 142
    If you can change solution, maybe using web service is a better solution.
  • JuhlJuhl Member Posts: 724
    Sorry, my post only contains the first line.
    I also surgested using WebService, and keeping everything separate even if in the same database.
    Follow me on my blog juhl.blog
Sign In or Register to comment.