Expand my Community achievements bar.

SOLVED

File Update

Avatar

Level 4

Hi,

How to write content to a new file or append content to an existing file in Campaign Classic - Workflows?

1 Accepted Solution

Avatar

Correct answer by
Level 5

Hi,

if I understand correctly, you have a text file on your adobe campaign server and want to edit it from a workflow.

If so you have a couple of ways to do this :

you can use a script activity, check the the process error option and print vars.output in JS activities afterwards.

to print long logs I like to use this :

var lines = vars.output.split("\n");

for each (var line in lines){

  logInfo("" + line);

}

command script.png

You can also do it all from a JS activity with execCommand (see API doc) :

var result = execCommand('echo "some data for the file" >> fileName');

logInfo(result);

You also have a bunch of methods in JS to access/edit files (cfr API doc) like writeIn.

Kind regards,

Pierre

View solution in original post

2 Replies

Avatar

Correct answer by
Level 5

Hi,

if I understand correctly, you have a text file on your adobe campaign server and want to edit it from a workflow.

If so you have a couple of ways to do this :

you can use a script activity, check the the process error option and print vars.output in JS activities afterwards.

to print long logs I like to use this :

var lines = vars.output.split("\n");

for each (var line in lines){

  logInfo("" + line);

}

command script.png

You can also do it all from a JS activity with execCommand (see API doc) :

var result = execCommand('echo "some data for the file" >> fileName');

logInfo(result);

You also have a bunch of methods in JS to access/edit files (cfr API doc) like writeIn.

Kind regards,

Pierre