In Dynamics AX 2009, we had a requirement to attach document with Purchase order table using x++ code while performing few options with PO.
For that purpose, we have to use following x++ AOT objects
void attachDoc(RefTableId _refTableId, RefRecId _refRecId, selectableDataArea _refCompanyId, FileName _name)
{
DocuRef docuRef;
DocuActionArchive archive;
;
docuRef.clear();
docuRef.RefRecId = _refRecId;
docuRef.RefTableId = _refTableId;
docuRef.RefCompanyId = _refCompanyId;
docuRef.Name = _name;
docuRef.TypeId = 'File';
docuRef.insert();
archive = new DocuActionArchive();
archive.add(docuRef, _name);
}
To call this method simply write following line and your document will be attached.
this.attachDoc(tableNum(PurchTable), purchTable.RecId, purchTable.dataAreaId, filepathname);
For that purpose, we have to use following x++ AOT objects
- DocuRef table
- DocuActionArchive class
void attachDoc(RefTableId _refTableId, RefRecId _refRecId, selectableDataArea _refCompanyId, FileName _name)
{
DocuRef docuRef;
DocuActionArchive archive;
;
docuRef.clear();
docuRef.RefRecId = _refRecId;
docuRef.RefTableId = _refTableId;
docuRef.RefCompanyId = _refCompanyId;
docuRef.Name = _name;
docuRef.TypeId = 'File';
docuRef.insert();
archive = new DocuActionArchive();
archive.add(docuRef, _name);
}
To call this method simply write following line and your document will be attached.
this.attachDoc(tableNum(PurchTable), purchTable.RecId, purchTable.dataAreaId, filepathname);
this code get error because not declaration docuvalue
ReplyDeletethis code work fine
//attached file
docuvalue docuvalue;
recid docuvaluerecid;
DocuRef docuRef;
DocuActionArchive archive;
ttsbegin;
docuRef.clear();
docuRef.RefRecId = _refRecId;
docuRef.RefTableId = _refTableId;
docuRef.RefCompanyId = _refCompanyId;
docuRef.Name = _name;
docuRef.TypeId = 'File';
docuRef.insert();
docuvalue.insert(); docuref.ValueRecId = docuvalue.RecId;
docuref.update();
docuvaluerecid = docuvalue.RecId;
select forupdate docuvalue where docuvalue.recid == docuvaluerecid;
docuvalue = docuvalue::writeDocuValue(docuref,_name+".xlsx");
ttscommit;
golden goose
ReplyDeleteoff white outlet
fear of god essentials
golden goose sneakers
a bathing ape
off white shoes
supreme
off white
golden goose outlet
yeezy boost 350 v2