Simple javascript problem
Posted: Tue May 26, 2020 10:17 am
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
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