Hi,
for my Backlog I need the User, who executed the Workflow, has someone an idea? In the Workflow it self I need this data, not before or after.
Thanks.
Greets NoTr3x
I think this info can be fetched by workflow execution log events.
Here is a code snippet showing how to enumerate all executions of the current workflow and for each completed execution to print the user name.
var executions = workflow.rootWorkflow.executions;
for each (var exec in executions) {
if (exec.endDateAsDate == null) continue;
System.log("execution completed on: " + exec.endDateAsDate);
for each (var ev in workflow.logEvents) {
if (ev.shortDescription.indexOf("has started") != -1) {
System.log(" ran by user: " + ev.originatorUserName);
}
}
}
Have a look at Server.getCurrentLdapUser() and Server.getCredential(). Not exactly sure if that's what you need (and if it even still works in current vRO configurations), but it might help.
Regards,
Joerg
Hi Joerg,
i mean:
I want to get the User Owner.
I think this info can be fetched by workflow execution log events.
Here is a code snippet showing how to enumerate all executions of the current workflow and for each completed execution to print the user name.
var executions = workflow.rootWorkflow.executions;
for each (var exec in executions) {
if (exec.endDateAsDate == null) continue;
System.log("execution completed on: " + exec.endDateAsDate);
for each (var ev in workflow.logEvents) {
if (ev.shortDescription.indexOf("has started") != -1) {
System.log(" ran by user: " + ev.originatorUserName);
}
}
}