Sharepoint 2010 Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint 2010       RSS Feeds

Remove domain from username

  Asked By: Paresh    Date: Dec 21    Category: Sharepoint 2010    Views: 2490

I have a workflow that sends an email with the Help Desk "Assigned To" rep name
inserted in the body.

For example, "The issue you reported has been marked "Resolved" by IT. Please
verify that the issue has been resolved to your satisfaction and notify
domain\username so that the issue can be Closed.

How can I make this cleaner by removing the "domain\" before the username?

Also, how can I make the username a mailto: URL?



7 Answers Found

Answer #1    Answered By: Sanjay Lohar     Answered On: Dec 21

The easiest way to manage that in a workflow is to use the SPDActivities
project on Codeplex (http://spdactivities.codeplex.com). This is a set of free workflow
actions, one of which is "Lookup user Info."

Lookup user Info uses SharePoint web services to return specific columns
from the user. You can specify "Display Name," "First Name," "Email,"
et. al. You simply added it as a step in your workflow and save the
result in a Workflow variable that you can then use in when sending an

SPDActivities does require you to deploy this code on your server, so if
that is not an option...

You can take advantage of the same functionality by using SPServices
(also on Codeplex @ http://spservices.codeplex.com), which is a jQuery library and allows
you to do many things from the client side, including calling the same
SharePoint Web Services the Lookup user Info activity does.

In this case, you'll want to:

1. Add a column (or two... one for Assignee Name, one for Assignee
Email Address) to your list or library: single line of text (Make them
optional; you're going to hide them on the page with jQuery.)
2. Add a Content Editor Web Part to your NewForm.aspx page (if Edit
Page isn't available, modify your URL to include
3. In the Source Editor of the CEWP, user jQuery to hide your
script-defined columns
4. Still in the CEWP, add Javascript/jQuery and SPServices to modify
the PreSaveAction() (which is automagically called when you click Save)
to look up the user name and email address of the Assignee and update
the hidden columns.
5. Now you'll have them as columns to use in your workflow.

Hint: If the Assigned To column can be changed on EditForm.aspx, you'll
want to add the CEWP to it so you can make changes to the hidden columns
when the user-defined column changes.

Needless to say, the Lookup user Info is much easier, but if the latter
is your only option and you need further guidance on the pieces, let me
know. As a preliminary guide, refer to my Extending the DVWP series on

Answer #2    Answered By: Vishnu Marigodar     Answered On: Dec 21

Has anyone ever gotten that "Lookup user info" action to work?

Answer #3    Answered By: Mariel Ferrell     Answered On: Dec 21

I use it often and it works as advertised. Else, I wouldn't have
suggested it.

Answer #4    Answered By: Bhavini Chinwalla     Answered On: Dec 21

I've been
really busy. I've downloaded and installed the SPDActivities. I located User
Profiles on the SharePoint Server. The full name property seems to be "Name",
but when I assign that property to my new variable, I still get "domain\user".
I keep at this as I have time.

Answer #5    Answered By: Kavita Thanki     Answered On: Dec 21

Try "Display Name" instead..............

Answer #6    Answered By: Bhavi Soni     Answered On: Dec 21

Got it working. The property fields I need to use are "First name", "Last name"
and "Work e-mail".

Answer #7    Answered By: Mitali Panchal     Answered On: Dec 21

There's lots of examples out there in vbscript for retrieving a 'displayName' or
a 'distinguishedName' given a 'sAMAccountName'. You could also retrieve the
associated 'mail' at the same time you're querying AD or LDAP. In any case,
though, you'd have to do some scripting in order to get that information to
insert into the message. Once you have all of that, you'd add it in to the

Didn't find what you were looking for? Find more on Remove domain from username Or get search suggestion and latest updates.