Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Update attachment file example

Avatar

Level 4

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

Level 4

Sorry my mistake -

This is referencing the Doc object,

so needed to use:

var myDoc = event.target;

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