1

I have created a simple list in SharePoint 2010 for employees to record their daily activity - each user creates 1 new item each day. When creating this new list, there is automatically a Title column which is required and shows as the first column. However that field is meaningless to this list, so I have currently defaulted it to just say Daily Activity.

I also have 3 other fields:

  1. User currently logged in
  2. Current date
  3. Rich text area for entering Details

I would like to automatically show a combination of the date and the user, for example:

Daily Activity - 10/10/2013 - John Smith

I've done quite a bit with SharePoint, but have never worked with anything like this. How can I make this list automatically combine these fields under the Title field?

  • 1
    You could write an event receiver to update the items :) – Gintas K Oct 14 '13 at 13:43
3
  1. If you don't want to write code...

    Use SharePoint Designer to create a workflow that is triggered when the item is created (assuming they can't edit it afterwards in which case you would need to trigger on update as well). Inside of the workflow you can set the value of the Title field using the "Set Field in Current Item" action and a combination of Created, Created By, and "Daily Activity". Just realize that there will be a little delay until the workflow completes and so it is possible that when the list first reloads the Title field might read "(no title)". Here's how to set the value once you've added the workflow:

    a. Click on "Action -> List Actions -> Set Field in Current Item"

    Set Field in Current Item

    b. Click on the "field" link and select your field. In my case it is "Location"

    Field

    c. Click on the "..." button. This will allow to use a combination of other fields to set the value for this field.

    Value

    d. That will bring you to a "String Builder" window. From there you can type in your string "Daily Activity - " and then click on the "Add or Change Lookup" button to add your field "Created" and "Created By". Make sure that when you add "Created" that you select "Short Date" for the "Return field as" dropdown otherwise it will return the date and time. Make sure also that for "Created By" you select "Display Name" for "Return field as" otherwise it will return the name plus the id for that user. In the end your expression will look like this:

    Add or Change Lookup

    Expression

  2. If you want to write code...

    Write an event receiver in c# as Gintas K mentioned and you'll basically be doing the same thing as in #1 above but with code instead. You'll need to hook in to the ItemAdding event. Check out this article.

  • Okay, I got the SharePoint designer installed, opened up the appropriate site / list, and have created a new Workflow. However I'm stumped as to how I need to configure it (following your first solution). – Jerry Dodge Oct 14 '13 at 20:25
  • Figured out how to add Action "Set Field in Current Item", and have done "Set [Title] to..." but what do I put for value? – Jerry Dodge Oct 14 '13 at 20:30
  • Check out the additional instructions that I've added to my answer. That should clarify things for you. – skeletank Oct 15 '13 at 13:26
  • Thanks - I have done this, saved and published, and have done a few tests but nothing seems to happen. Can you explain this delay? – Jerry Dodge Oct 15 '13 at 13:51
  • Have you saved and published the workflow? If so then go to the display form for the item and go to the "View" tab. Then select "Workflows" under "Actions". See if there are any completed workflows or ones that have errored out. – skeletank Oct 15 '13 at 13:56
1

The simplest method would probably be to create an InfoPath form for your list. For the Title field, set the default value to

concat("Daily Activity - ", today(), " - ", userName())

Uncheck "Refresh value when formula is recalculated", otherwise editing an old item will change its title and potentially overwrite someone else's form. That might be functional enough for your needs, but if you must have formatting like your example check out this or this to get the correctly formatted username, and use translate(today(), "-", "/") for the date.

0

The simplest no code method is to change the default value for the Title column as a calculated value. This blog shows how to set the value to a year. For your requirements try:

Go to the List Settings, Click the Title column and change the default value.

Paste the following code into the box to give you what you require:

"Daily Activity -" & TEXT(Today,"mm/dd/yyyy") & " - " & Me

Note: The value of Me does not provide the First Last name, but the domain\username.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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