Menu Close

D365FO Copy document from table to another

Below x++ code used to copy document from table to table or from record to another table

public static void copyDocuRef(smmActivities _smmActivitiesFrom, smmActivities _smmActivitiesTo)
        DocuRef smmActivitiesFromDocuRef;

        while select  smmActivitiesFromDocuRef
            where   smmActivitiesFromDocuRef.RefTableId     == tableNum(smmActivities)
            &&      smmActivitiesFromDocuRef.RefRecId      == _smmActivitiesFrom.RecId
            DocuRef::createFromDocuRef(smmActivitiesFromDocuRef, _smmActivitiesTo.RecId , tableNum(smmActivities));


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.