How to add a document handling note in Microsoft Dynamics 365 for Finance and Operations through X++



How to add a document handling note in
Microsoft Dynamics 365 for Finance and Operations 
through X++




        custTable             custTable;
        DocuType            docuType;
        DocuRef              docuRef;

        custTable   = custTable::find('US-001');
        docuType   = DocuType::find('Note');

        if (!docuType || docuType.TypeGroup != DocuTypeGroup::Note)
        {
            throw error("Invalid type");
        }
        docuRef.RefCompanyId    = custTable.dataAreaId;
        docuRef.RefTableId           = custTable.TableId;
        docuRef.RefRecId              = custTable.RecId;
        docuRef.TypeId                  = docuType.TypeId;
        docuRef.Name                    = 'Add note';
        docuRef.Notes                    = 'Add note using x++';
        docuRef.insert();

Comments

Popular posts from this blog

How to loop through enum in dynamics ax 2012 using x++

How to read from csv file in Dynamics AX 2012 Through X++

How to Create Transfer Journal in Dynamics AX 2012 Through X++