I am using the workflow in this link: http://www.vcoteam.info/articles/learn-vco/176-how-to-retrieve-workflow-execution-details.html to retrieve workflow execution details. thanks Burke. I want to be able to also print out to System.log any "Exception" errors that occurred. How can I do that?
Here is the same code with fixed parenthesis:
var tokens = requestFlow.executions; // Each execution is a "workflowToken" object
for each (token in tokens) {
try {
if (token.isStillValid) {
System.log("");
System.log("==== Checking token ====");
System.log("Start Date: "+token.startDate);
if (token.endDate != null) {
System.log("End Date: "+token.endDate);
}
if (token.exception != null) {
System.log("Exception: "+token.exception);
}
}
} catch(ex) {
System.log(ex)
}
}
I also added a couple of lines to print the exception property of the workflow token (see the last System.log() statement above). I guess this is what you are interested in.
Try and catch are the error handler you are looking for and would look something like this...
var
tokens = requestFlow.executions;
// Each execution is a "workflowToken" object
for
each (token
in
tokens){
try{
if
(token.isStillValid){
System.log(
""
);
System.log(
"==== Checking token ===="
);
System.log(
"Start Date: "
+token.startDate);
if
(token.endDate !=
null
){
System.log(
"End Date: "
+token.endDate);
}
}catch(ex){
System.log(ex)
}
this code is giving me a syntax error with parenthesis and I can't figure out where the error is.
Here is the same code with fixed parenthesis:
var tokens = requestFlow.executions; // Each execution is a "workflowToken" object
for each (token in tokens) {
try {
if (token.isStillValid) {
System.log("");
System.log("==== Checking token ====");
System.log("Start Date: "+token.startDate);
if (token.endDate != null) {
System.log("End Date: "+token.endDate);
}
if (token.exception != null) {
System.log("Exception: "+token.exception);
}
}
} catch(ex) {
System.log(ex)
}
}
I also added a couple of lines to print the exception property of the workflow token (see the last System.log() statement above). I guess this is what you are interested in.