Is there any way to retrieve both the first and last name of a user’s manager as a Data IN value for a field? The only relevant Macro is “Current user.Manager”, which retrieves the USERNAME of the manager. But I need the actual first and last name of the manager instead. Any ideas?
Thanks for reading!
Unfortunately, there is not a macro or a built-in feature that allows you to do that.
You can, however, store the full name of the manager in of the extended attributes and use this macro instead.
Otherwise, you can use the Current user.Manager macro to retrieve the username and then query the database in code-behind to retrieve the full name.
Do you have example code for how to query the WorkflowGen user data.
In my case, I have a username, and I want to Lookup that users First and Last name?
Ideally, it would check to see if they are a user in WorkflowGen at the same time.
You can use the following code as an example :
string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["MainDbSource"].ToString();
string queryString = "SELECT [LASTNAME],[FIRSTNAME] FROM [USERS] WHERE USERNAME = '" + USERNAME + "'";
using(System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(connectionString))
System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(queryString, sqlConnection);
using (System.Data.SqlClient.SqlDataReader reader = command.ExecuteReader())
lastname = reader.GetString(0);
firstname = reader.GetString(0);
There is no need to do code behind for this anymore.
New macros for Manager.FirstName and Manager.LastName have been included in version 7.15.0.
The Manager macro has now been switched to Manager.Username.
This applies to the Current user, assigned user, requester and action initiator.