Page 1 of 1

File stuck in Folder before script

Posted: Tue Sep 29, 2020 11:26 am
by stdougal
Hi,

We made a script to update the current status of a job as the file passes through the various stages of a flow in Switch.

The script is working as expected and is updating all the various fields in our system.

However we have an issue:
Currently the file(s) are stuck in the connector folder before the script (there is no connections after the script!).

I would appreciate any help/suggestions?

Below is a rough idea of the script

function jobArrived( s : Switch, job : Job )
{
if (setToken(job))
{
// start the operation
if( finished && theHTTP.finishedStatus == HTTP.Ok && theHTTP.statusCode == 200 )
{
//success - operation started
//Now get the ID from the response
if( finished && theHTTP.finishedStatus == HTTP.Ok && theHTTP.statusCode == 200 )
{
//success - Got ID now finish operation
if( finished && theHTTP.finishedStatus == HTTP.Ok && theHTTP.statusCode == 200 )
{
//success
return true;
}
else
{
//fail
job.fail( "Failed to stop" );
}
}
else
{
//fail
job.fail( "Failed to get id" );
}
}
else
{
//fail
job.fail( "Failed to start" );
}
}
else
{
job.fail( "Failed Token" );
}
job.sendToNull( job.getPath() );
}

Thank You

Re: File stuck in Folder before script

Posted: Tue Sep 29, 2020 11:32 am
by jan_suhr
You need a job.sendToSingle for it to go out of the script.

Re: File stuck in Folder before script

Posted: Tue Sep 29, 2020 11:53 am
by stdougal
Thank you for the quick reply

Do I need that if I don't want the file to continue on i.e. If I just want to trigger this script and have the file delete?

Is it possible to trigger a script without a PDF passing through it?

Re: File stuck in Folder before script

Posted: Tue Sep 29, 2020 12:05 pm
by jan_suhr
If you just want it to trigger you use the job.sendToNull that you have there.
But check with a s.log() that you really end up in that step.

Re: File stuck in Folder before script

Posted: Tue Sep 29, 2020 4:50 pm
by stdougal
That's Great

Thank you for your help