How to get person's name or email who triggered task

I’m learning about Action Center. I can see that you can assign a task to a username or an email address.

But my question is: How to fetch the name of the current user that created the task? I see in the task object there is a creator ID property. Is there a way to fetch the user’s name or email by using that ID perhaps using an API call? Is there a function? Is there an activity?

I’d like to add a field in the Action Center like “Requested By” with their name. This seems like a basic feature. Perhaps this ability is already there and I don’t know about it yet?

Or is there a general way to get the user’s name as they appear in UiPath for forms and things? It seems silly to have them type in their name into a form.

I know this is possible, because UiPath Studio knows your full name and whether you’re logged into Orchestrator, so it must use an API call to fetch it.

Please don’t say System.Environment.Username – that only returns my windows name. I want my name as it appears in UiPath.

In UiPath, you can indeed fetch the creator’s name or email of a task by using the Orchestrator API. Here’s how you can approach this:

  1. Task Object’s Creator ID: You mentioned that the task object contains a “creator ID.” This ID corresponds to the user who created the task in Orchestrator.

  2. Fetch User Details: You can use the Orchestrator API to fetch the details of a user by their ID. Specifically, the GET /odata/Users({id}) endpoint can be used to retrieve the user’s details (including name, email, etc.).

Here’s a simple example of how to fetch the user details:

  • URL: /odata/Users({userID})
  • Method: GET
  • Response: This will return the user’s full details, including the display name and email.
  1. In UiPath: You can use the HTTP Request activity to call the Orchestrator API and retrieve the user details. You’ll need to pass the creator’s ID (from the task object) into the API call.

Steps:

  • Use the Get Task activity to fetch the task object, which will contain the creator ID.
  • Use the HTTP Request activity to make a GET request to the Orchestrator API endpoint /odata/Users({creatorID}).
  • Parse the response to extract the user’s name or email and display it in the Action Center or use it elsewhere in your process.

By using this approach, you can automatically fetch and display the “Requested By” field without needing the user to manually enter their name.

Let me know if you need help with setting up the HTTP request or parsing the API response!

Thank you Shakib!

The problem I’m having now is that the CreatorID comes from the Create Form Task Activity which outputs an object which I call objTask. But it has already created the form by then. I want to pass in the user’s name to the form in the Action Center “Requested By”.

I guess what I need to learn is how to make an API call to Orchestrator to get the name of the current user regardless of where I am in the process? How to get the current user’s ID and THEN make the call to get the full name?

The system knows my ID, because it put it in the objTask. So how do I fetch that directly?

I FIGURED IT OUT!

You must get the user info by an Orchestrator HTTP Request activity BEFORE you call Create Task Form activity.

The sticky part is that this call must be in a separate workflow if you’re making a call to the Action Center. This is because the process will try to bundle up all the variables you have in your main scope to send to the action center. If you have a JSON object there, it will error.

So here’s my workflow to fetch the user name:

the endpoint to use is:
"/odata/Users/UiPath.Server.Configuration.OData.GetCurrentUser"

then to fetch specifics and save into strings to pass out of workflow:

Full name: objJSON.GetValue(“FullName”).toString
Email: objJSON.GetValue(“UserName”).toString

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.