Upland OL User community

Write to a file from Designer

Hello,

i need to load the value in a file to a datamapper field for a record (loadtext is working for this).
Then I have to modify the value, and write it back for the next record.

How can I achieve this.

My script looks like:
var lansym = record.fields.Landsymbol_Versandadresse;

if (lansym.trim() == "AT")
{
	var nr = loadtext("C:/PlanetPress/Einzelhandel/ATNR/Number.txt");
	nr = nr.replace("07","XX");
	result = nr;
	/* not working
     file = openTextWriter("C:/PlanetPress/Einzelhandel/ATNR/Number.txt");
	file.write(result);
	file.close();
	*/
}
results.html(result);

Many thanks for your answers.

You’ll better do that in the Datamapper as in the template you can neither write to file nor do you have variables with global scope.