Attach file to data row

霸气de小男生 提交于 2019-12-25 00:15:49

问题


I am trying to attach a text file to a data row in my custom object. I must be missing something. I have the pointer to the current record (asn) and the Byte array (retLabels.Labels) but I can't figure out what the third parameter should be. Also, do I need to execute an update and save after attaching the file?

if (retLabels.Code == "OK" || ediDemo)
{
    asnGraph.ASN.Current = asn;
    PXNoteAttribute.AttachFile(asn, retLabels.Labels, ???? PX.SM.FileInfo );
}

回答1:


Create the file in memory:

PX.SM.FileInfo file = new PX.SM.FileInfo("textfile.txt", 
                                         null,
                                         Encoding.UTF8.GetBytes("Text file content."));

Upload the file in Acumatica:

UploadFileMaintenance upload = PXGraph.CreateInstance<UploadFileMaintenance>();

upload.SaveFile(file, 
                FileExistsAction.CreateVersion);

Attach the file to any DAC records by linking file UID (unique ID) to DAC NoteID field:

PXNoteAttribute.SetFileNotes(Base.Caches[typeof(DAC)], dacRecord, file.UID.Value);


来源:https://stackoverflow.com/questions/51508669/attach-file-to-data-row

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!