VMware Cloud Community
NoTr3x
Contributor
Contributor
Jump to solution

Workflow - Get User Owner

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

Tags (3)
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

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);

    }

  }

}

View solution in original post

3 Replies
tschoergez
Leadership
Leadership
Jump to solution

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

0 Kudos
NoTr3x
Contributor
Contributor
Jump to solution

Hi Joerg,

i mean:

pastedImage_0.png

I want to get the User Owner.

0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

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);

    }

  }

}