File stuck in Folder before script

Post Reply
stdougal
Newbie
Posts: 8
Joined: Wed Oct 14, 2015 3:16 pm

File stuck in Folder before script

Post by stdougal » Tue Sep 29, 2020 11:26 am

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

jan_suhr
Advanced member
Posts: 422
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: File stuck in Folder before script

Post by jan_suhr » Tue Sep 29, 2020 11:32 am

You need a job.sendToSingle for it to go out of the script.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps

stdougal
Newbie
Posts: 8
Joined: Wed Oct 14, 2015 3:16 pm

Re: File stuck in Folder before script

Post by stdougal » Tue Sep 29, 2020 11:53 am

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?

jan_suhr
Advanced member
Posts: 422
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: File stuck in Folder before script

Post by jan_suhr » Tue Sep 29, 2020 12:05 pm

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.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps

stdougal
Newbie
Posts: 8
Joined: Wed Oct 14, 2015 3:16 pm

Re: File stuck in Folder before script

Post by stdougal » Tue Sep 29, 2020 4:50 pm

That's Great

Thank you for your help

Post Reply