Copy Attachment From one Record to another in x++

   private void copyAttachments(RecId _copyFromRecid,TableId _copyFromTableId, RecId _copyToRecid,TableId _copyToTableId)


    {


        DocuRef copyfromDocuRef;


        DocuRef ProjTableDocuRef;


        //Search if exists an attachment 


        while select  copyfromDocuRef

            where copyfromDocuRef.RefTableId == _copyFromTableId

            &&   copyfromDocuRef.RefRecId == _copyFromRecid


        {


            //Copy attachment 


            DocuRef::createFromDocuRef(copyfromDocuRef,_copyToRecid , _copyToTableId);


        }

    }


Regards 
Muhammad Farraz

email: farazjaved01@gmail.com

Comments

Popular posts from this blog

How to Bypass Next in COC in D365 X++

create movement journal through code in d365 FO x++