Expand my Community achievements bar.

We are excited to introduce our latest innovation to enhance the Adobe Campaign user experience — the Adobe Campaign v8 Web User Interface!
SOLVED

Moving a Text File to SFTP

Avatar

Level 4

Hello

I was wondering if someone can show me how to create a text file with any dynamic content and move it to SFTP. Currently I am able to move only text files or CSVs containing any query results to sftp.

I am using Adobe Campaign Classic v6.7. The SFTP that I am trying to move is the one that came with the Adobe Campaign.

Thanks,

Ganesh

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

HI Ganesh,

You can do so in a JS activity.

I have a query activity of which I'm trying to create a file. You can adapt it to your scenario

var query = xtk.queryDef.create(

  <queryDef schema="temp:query" operation="select">

    <select>

      <node expr="@deliveryId"/>

      <node expr="@broadLogId"/>

    </select>

  </queryDef>);

var result = query.ExecuteQuery();

// Create the txt file

var f = new File("/sftp/<customerName>/incoming/MyFolder/myFile.txt");

// Open file on Write mode

f.open("w");

for each (var record in result) {

     

    // Write on the file

    f.writeln(record.@deliveryId + "," + record.@broadLogId);

     

    } // end for

     

// Close file

f.close();

The file has been created on Adobe sFTP inside MyFolder

Regards,
Vipul

View solution in original post

1 Reply

Avatar

Correct answer by
Employee Advisor

HI Ganesh,

You can do so in a JS activity.

I have a query activity of which I'm trying to create a file. You can adapt it to your scenario

var query = xtk.queryDef.create(

  <queryDef schema="temp:query" operation="select">

    <select>

      <node expr="@deliveryId"/>

      <node expr="@broadLogId"/>

    </select>

  </queryDef>);

var result = query.ExecuteQuery();

// Create the txt file

var f = new File("/sftp/<customerName>/incoming/MyFolder/myFile.txt");

// Open file on Write mode

f.open("w");

for each (var record in result) {

     

    // Write on the file

    f.writeln(record.@deliveryId + "," + record.@broadLogId);

     

    } // end for

     

// Close file

f.close();

The file has been created on Adobe sFTP inside MyFolder

Regards,
Vipul