将文件附加到数据行 [英] Attach file to data row

查看:83
本文介绍了将文件附加到数据行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将文本文件附加到自定义对象中的数据行.我肯定错过了什么.我有指向当前记录(asn)和字节数组(retLabels.Labels)的指针,但是我无法弄清楚第三个参数应该是什么.另外,附加文件后是否需要执行更新并保存?

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 );
}

推荐答案

在内存中创建文件:

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

在Acumatica中上传文件:

Upload the file in Acumatica:

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

upload.SaveFile(file, 
                FileExistsAction.CreateVersion);

通过将文件UID(唯一ID)链接到DAC NoteID字段,将文件附加到任何DAC记录:

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);

这篇关于将文件附加到数据行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆