Document Handling

speedykenspeedyken Member Posts: 15
edited 2007-05-21 in Dynamics AX
Hi,

In Axapta there is a form smmDocuments that is uses on CRM --> Business Relations and click there on the button Documents.
Here you can add files to a Business Relation.

Now, there is an other form DocView that you can call from any form in the toolbar. On this form you can ad a document to a record that has been selected when you clicked this button.

Now is my question:
On smmDocuments you have an ActiveX control where you just have to put the file on that button and it's imported in a record.

Is this possible to insert this ActiveX control in the Docview form and let it work?

Greetings.

Comments

  • speedykenspeedyken Member Posts: 15
    Problem Solved.

    Only a few rules in the classdeclaration and in de dropfile method needed to make it work.

    Greetz
    // AOSRunMode::Client
    void onEvent_DropFile(COMVariant _strFilePath)
    {
        DocuTypeId docuTypeId;
        ;
    
        docuTypeId = DocuType::findDroppedObjectType(smmDragDropObjectType::Document);
    
        // Check that document type is set up in CRM parameters form
        if (canAdd && docuTypeId)
        {
            fileAdd = true;
    
            docuRef_ds.create();
    
            docuRef.RefRecId    = actualTableId;
            docuRef.RefTableId  = actualRecId;
    
            if (!smmDocuments::insertDroppedFile(_strFilePath.bStr(), docuRef))
            {
                docuRef_ds.delete();
            }
            else
            {
                docuRef_ds.reread();
            }
        }
        else
        {
            // Document type is not set up in the CRM parameters
            throw error("@SYS86581");
        }
    }
    
Sign In or Register to comment.