I have a flow that will reach out and grab a folder from a location and injects it into a flow via metadata.
What i need is;
if (folder exists){current code}
else {send email}.
I have tried the job.getFileCount() but I couldn't retrieve a value with a location path.
Any suggestions would be helpful.
Thanks,
PH
function jobArrived( s : Switch, job : Job )
{
var JobNumber = job.getVariableAsString('[Metadata.Text:Path="/field-list/field[2]/field-list/field/value",Dataset="Submit",Model="XML"]');
var theSourcePath = job.createPathWithName( JobNumber );
s.copy( "/Users/prinergy/Desktop/Fake jobs/"+JobNumber, theSourcePath );
job.sendToSingle( theSourcePath );
job.sendToNull( job.getPath() );
s.log(1,JobNumber);
}
Testing to see if a folder exists in a location
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Testing to see if a folder exists in a location
You can't send an email directly from a script. You will have to set the email variables and send it using an Email Send element in you flow.
function jobArrived( s : Switch, job : Job )
{
var JobNumber = job.getVariableAsString('[Metadata.Text:Path="/field-list/field[2]/field-list/field/value",Dataset="Submit",Model="XML"]');
var theSourcePath = job.createPathWithName( JobNumber );
var folderName = "/Users/prinergy/Desktop/Fake jobs/"+JobNumber;
if (File.exists(folderName)) {
s.copy( folderName, theSourcePath );
job.sendToSingle( theSourcePath );
job.sendToNull( job.getPath() );
s.log(1,JobNumber);
} else {
s.log(1,"Folder " + folderName + " does not exist");
}
}
function jobArrived( s : Switch, job : Job )
{
var JobNumber = job.getVariableAsString('[Metadata.Text:Path="/field-list/field[2]/field-list/field/value",Dataset="Submit",Model="XML"]');
var theSourcePath = job.createPathWithName( JobNumber );
var folderName = "/Users/prinergy/Desktop/Fake jobs/"+JobNumber;
if (File.exists(folderName)) {
s.copy( folderName, theSourcePath );
job.sendToSingle( theSourcePath );
job.sendToNull( job.getPath() );
s.log(1,JobNumber);
} else {
s.log(1,"Folder " + folderName + " does not exist");
}
}
Testing to see if a folder exists in a location
Do i have to declare File as a Var?
Thanks,
PH
Thanks,
PH
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Testing to see if a folder exists in a location
no, because File.exists() is a static function.
Testing to see if a folder exists in a location
Is there a site that lists all of the static function?
Thanks,
Paul hough
Thanks,
Paul hough
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Testing to see if a folder exists in a location
No, you have to review the Javascript documentation for each class. It will list the static functions.
http://www.enfocus.com/Manuals/UserGuid ... S/home.htm
http://www.enfocus.com/Manuals/UserGuid ... S/home.htm
Testing to see if a folder exists in a location
Thanks for your help
PH
PH