Page 1 of 1

Simple javascript problem

Posted: Tue May 26, 2020 10:17 am
by BartDenolf
Hello,

I'm not very used to scripting in Switch, so I probably made a mistake in my script. I want to extract the name of someone using the email address included in private data "EMAIL" and then replacing the "." with a space and reinsert it as an other private data to be used later.

If I use the script-element my job stays in the folder before the script, no error message or what so ever. It just does nothing.

This is my script:

function jobArrived( s : Switch, job : Job )
{
var Email = job.getPrivateData("EMAIL");
var Naam = Email.substring(0,Email.indexOf("@"));
Naam = Naam.replace("."," ");
job.setPrivateData("NAAM",Email);
}

Thank you very much
Bart

Re: Simple javascript problem

Posted: Tue May 26, 2020 10:45 am
by jan_suhr
You have to add an outgoing connection

job.sendToSingle() for example, it will send your file to the next folder.

Re: Simple javascript problem

Posted: Tue May 26, 2020 11:01 am
by BartDenolf
Thanks Jan,

This did the job!

Greetings
Bart