File stuck in Folder before script
Posted: 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
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