Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

Adding a document to a row programmatically

$
0
0

Hello,using the following code,i'm trying to add a document to a table; however i can not see anything added in document management.The code also doesn't give any errors, any ideas how to resolve it ?

    DocuRef docuRef;
    DocuActionArchive archive;
    
    erm_OperationInstructions oprinst;
    

    Name _name = "C:\\test.txt";
    
    
    select firstOnly * from oprinst where oprinst.OperationId == 'OP0001002';
    
    
    try
    {
        ttsBegin;
        
        docuRef.clear();
        docuRef.RefRecId = oprinst.RecId;
        docuRef.RefTableId = tableNum(erm_OperationInstructions);
        docuRef.RefCompanyId = curext();
        docuRef.Name = "testfile";
        docuRef.TypeId = 'FILE';
        docuRef.insert();
        archive = new DocuActionArchive();
        archive.add(docuRef, _name);          
        
        ttsCommit;
    }
    catch(Exception::Error)
    {
        info(strfmt("%1",Exception::Error));

    }

Viewing all articles
Browse latest Browse all 175888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>