Expand my Community achievements bar.

Update attachment file example

Avatar

Former Community Member

Hi There,

Does anybody have an example Livecycle PDF form which allows you to update the contents of an attachment?

I'm trying the following code, but nothing seems to be happening (i.e. the file is not updated)...  the doco does not say this is a security violation, but I'm thinking it might have changed:

var oFile = this.getDataObjectContents("MyNotes.csv");
var cFile = util.stringFromStream(oFile, "utf-8");
TextField2.rawValue = cFile;
cFile += "\r\n" + cFile + TextField1.rawValue ;
console.println("cFile:" + cFile);
oFile = util.streamFromString( cFile, "utf-8");
this.setDataObjectContents("MyNotes.csv", oFile);

1 Reply

Avatar

Former Community Member

Sorry my mistake -

This is referencing the Doc object,

so needed to use:

var myDoc = event.target;

var oFile = myDoc.getDataObjectContents("MyNotes.csv");