Microsoft Dynamics AX/AX 2012
X++로 레코드에 파일 첨부하기
Isaac Lee
2018. 11. 23. 16:15
Dynamics AX는 레코드 별로 파일을 첨부하여 저장할 수 있습니다.
다음 소스는 UI가 아닌 X++ 로 특정 레코드에 파일을 첨부하는 기본코드입니다.
이를 활용하면 필요에 따라 다중 파일 일괄 업로드도 가능합니다.
public void multiFileUpload()
{
DocuRef docuRef;
DocuActionArchive archive;
Filename _fileName;
FilePath _filePath;
_fileName = "업로드 파일 명 (전체경로)";
if(WinAPI::fileExists(_fileName))
{
ttsBegin;
docuRef.clear();
docuRef.RefRecId = 첨부할 테이블의 레코드ID;
docuRef.RefTableId = 첨부할 테이블 No.; // 예) tableNum("CustTable");
docuRef.RefCompanyId = curext();
docuRef.Name = _fileName;
docuRef.TypeId = 'File';
docuRef.insert();
archive = new DocuActionArchive();
archive.add(docuRef, _fileName);
ttsCommit;
}
}
Happy DAXing!!