问题
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