Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am attempting to set the default value of the Title item in a list so that it is more informative -- I have the Title field "hidden" from the user, but my company's workflow utilizes Title in workflow emails.

I want the title to contain the submitter's Display Name. I have seen the =[Me] function but that returns the entire DOMAIN\username which is really ugly in my case.

If the Display Name isn't possible am I able to use something like a REPLACE function to at least remove the DOMAIN\ from the string (so that just the user name remains)?

I've tried to do simply:

=REPLACE([Me],"DOMAIN\","")

But I get a syntax error.

Any ideas?

share|improve this question
1  
You may find this calculated column quick reference "Cheat Sheet" useful - blog.pentalogic.net/2011/05/… –  Ryan Jul 7 '11 at 6:56

2 Answers 2

up vote 2 down vote accepted

This is a good reference on calculated columns.

I've found the easiest way (for me) to get user information is using SPServices and jQuery and setting the field value on item submission. With SPServices SPGetCurrentUser operation, you can get various properties when they're filling out the form and put that into the hidden title field right away.

share|improve this answer
    
That SPServices looks interesting but is probably a little more intense than what I was looking for ... anyhow, I was able to use this =RIGHT(Me,LEN(Me)-14) and it is working great (or as good as I can hope without really getting into it). Thanks. –  thornomad Jul 6 '11 at 17:48

The REPLACE function takes 4 parameters, so you would need to write it like this:

=REPLACE([Me],FIND("DOMAIN\",[Me]),LEN("DOMAIN\"),"")

EDIT: For the default value of a column, [Me] is fine.

However, you cannot use [Me] in a calculated column, so this will not work either. And, from your description it sounds like you want the user that created the list item, not the current user. So, then you would want to use [Created By]. Unfortunately, you cannot use this in a calculated column either.

Instead, you can create a workflow in SharePoint Designer that executes when an item is added. In your workflow, you can get the current user and update the Title field with that value.

share|improve this answer
    
Apparently the OP is talking about a calculated value in a text column, not a calculated column. In this case [Me] is allowed. –  Christophe Jul 7 '11 at 2:52
    
Ah, now the question makes sense. I missed the words "set the default value". Thanks. –  Laurie Jul 7 '11 at 3:18
    
I don't have access to SharePoint designer - would have to talk with IS to get that implemented ... but, I appreciate your insight on the REPLACE function. I'm sure to need that soon. Thanks! –  thornomad Jul 7 '11 at 11:45
    
=REPLACE([Me],FIND("DOMAIN\",[Me]),LEN("DOMAIN\"),"") is working for me...Thanks guys. –  anil kumar Oct 23 '12 at 7:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.