VMware Cloud Community
gdealmeida
Contributor
Contributor
Jump to solution

Retrieve the Display Name of the validator of a workflow following a User Interaction

Hello,

I'm trying to make a simple workflow with a User Interaction item. I want after this validation send an email to the requester with the Display Name of the user (validator) who answer the User Interaction.

I can easily retrieve the requester's DisplayName with the following command but not the "validator".

var var_requester = Server.getCurrentLdapUser().displayName;

Do you have any idea how to do that ?

Thx.

1 Solution

Accepted Solutions
DWBrush
Contributor
Contributor
Jump to solution

Another way to do it would be to create a string argument in the External Input of your User Interaction element and bind it to an attribute in your workflow, call it something like argInteractionUser. On the Presentation tab in the User Interaction element, find that parameter add the 'Hide parameter' input property and define it as true. Also add a 'Data binding' property and leave it blank for now.

Then create an action element with no inputs and a return type of string. Use the following code in the action element:

return Server.getCurrentLdapUser().displayName;

Save the new action element as getCurrentLdapUserDisplayName

Then, on the 'Data binding' property on your User Interaction that you created earlier, call your new action element. It'll look something like this:

GetAction("com.yourcompany.yourfolder","getCurrentLdapUserDisplayName").call()

You should now have an attribute in your workflow that will contain the name of the person who interacted with the User Interaction element to do with as you please.

Cheers,

-D

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.

View solution in original post

5 Replies
DWBrush
Contributor
Contributor
Jump to solution

Hello,

Just to clarify, you want to get the display name of the person who interacted with the User Interaction item, correct?

-D

0 Kudos
gdealmeida
Contributor
Contributor
Jump to solution

Hello DWBrush,

It’s correct. I didn’t find the way to get that.

0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

This information is not accessible directly from the user interaction or workflow execution. You can fetch it, however, from the log events for the workflow execution.

To get the log events:

- if you have the workflow execution object, then you can get the events from it

var allEvents = tokenObj.logEvents;

- if you don't have the execution object, you can query for all events, using criteria like workflow ID, the time interval, etc. Here is an example how to fetch all log events by a workflow ID

var query = new LogQuery();

query.originatorId = "42e8e57a-6849-4410-a02d-eaa1cfccd17c"; // workflow ID

var allEvents = Server.fetchLogEvents(query);

Once you get the events, you can iterate over them and find the one for the answer of user interaction. It's longDescription property should be something like:

User input '{workflow-name} : {interaction-name}' has been accepted

and the name of the user answered the interaction will be in the property originatorUserName of the log event.

0 Kudos
DWBrush
Contributor
Contributor
Jump to solution

Another way to do it would be to create a string argument in the External Input of your User Interaction element and bind it to an attribute in your workflow, call it something like argInteractionUser. On the Presentation tab in the User Interaction element, find that parameter add the 'Hide parameter' input property and define it as true. Also add a 'Data binding' property and leave it blank for now.

Then create an action element with no inputs and a return type of string. Use the following code in the action element:

return Server.getCurrentLdapUser().displayName;

Save the new action element as getCurrentLdapUserDisplayName

Then, on the 'Data binding' property on your User Interaction that you created earlier, call your new action element. It'll look something like this:

GetAction("com.yourcompany.yourfolder","getCurrentLdapUserDisplayName").call()

You should now have an attribute in your workflow that will contain the name of the person who interacted with the User Interaction element to do with as you please.

Cheers,

-D

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.

gdealmeida
Contributor
Contributor
Jump to solution

Hello guys,

I try with the solution provide by DWBrush and it's works fine.

I have not tested the other solution provided but I think it also meets the need.

Thank for your help.

Cheers,