Access Switchscripter error in mail body (next module)

Post Reply
automation
Member
Posts: 30
Joined: Tue Jan 15, 2019 10:19 pm

Access Switchscripter error in mail body (next module)

Post by automation » Tue Jul 07, 2020 9:17 am

I have a switchscripter with a trafic light. If the scripts fails (error) the xml goes to the next model, mail send and this is working.

In my switchscripter code I have this loggin and I get the errors fine in the log.

job.fail( "Process shipment marking failed with the status code %1", theHTTP.statusCode );
job.fail("invalid response: %1", theHTTP.lastError);
job.log( 1, "Server response: %1", theHTTP.getServerResponse().toString( "UTF-8" ) );

But I want to access this errors in my nextmodule, the mail send email body. How can I do that?
theHTTP is not accessible from the email body so I can't use something like
[job.theHTTP.lastError]

freddyp
Advanced member
Posts: 571
Joined: Thu Feb 09, 2012 3:53 pm

Re: Access Switchscripter error in mail body (next module)

Post by freddyp » Tue Jul 07, 2020 1:06 pm

job.fail takes the job to Problem jobs. When working with a traffic-light output you have to use

Code: Select all

job.sendToData( 1/2/3, job.getPath());
Where 1 takes it to success, 2 to warning and 3 to error.
And as to putting the error messages in the mail body:

Code: Select all

job.appendEmailBody("Process shipment marking failed with the status code " + theHTTP.statusCode );
job.appendEmailBody("invalid response: " + theHTTP.lastError);
and in the "Mail send" element set "Include attached body text" to "Yes".

Post Reply