My 2p about ERP Solutions, Information Worker Solutions and other software products (mainly Microsoft Dynamics AX and Microsoft SharePoint).

08 April 2008

Fill field by default with current user

by Patrik Luca 5 comments

Tag



Business requirement: how to fill a field by default with the current user?


Having set up the Help Desk template (one of the 40 application templates), my end-users asked if the field Customer could be filled up by default with the user creating the service request. The Customer field should only be filled up by default if the creator of the service request didn't fill out a value himself. The option should left open for the end-user to create a service request for somebody else: in such a case the end-users still needed to be able to fill out a value themselves (being the login of the colleague for whom they were submitting a service request).

Solution: use a workflow to set the default user to the current user


Part 1: Set customer column not required



  1. Set the column setting Require that this column contains information to No.



Part 2: Create a workflow to set the default user to the current user



  1. Create a new workflow in Microsoft Office SharePoint Designer 2007: File->New->Workflow.

  2. Give a name for the workflow, attach it to the Service Requests SharePoint list and check the option Automatically start this workflow when a new item is created.

  3. Check for the condition If Customer is empty

  4. As Action choose Set Field in Current Item

    1. Choose the field Customer.

    2. For the value, choose User who created current item (it will be translated by Microsoft Office SharePoint Designer 2007 to Service Requests:Created By.



  5. Click Finish

Comments 5 comments
Brent said...

Someone sent me to your Blog to view your steps based on a submission I posted in a Forum, and your steps worked Great!

Patrik Luca said...

Hi Brent,

glad to hear my post could help you out!

Nilesh Vasave said...

Or alternately, you can create a Customer column as calculated field and in the formula for that calculated field write =[Me] and it will give you the same value as createdBy.

Regards,
Nilesh Vasave

Jimmy said...

hi, after reading most of your posting, i think think this is the best place to ask you this.

how to create a dynamic newform field?

for example. 2 fields, "Type"
"sub-products"

"Type" will have choice of 'abc' '123'

"sub-products" choices will be depend on the choice of "Type".
if 'abc' is choosen, "sub-products" will have the choices of 'a' 'b' 'c'
if '123' is choosen, "sub-products" will have the choices of '1' '2' '3'

best if these two fields is on the same page. and if possible use javascript.

and also, can "sub product" be multi-selection instead of dropdown?

Anonymous said...

This gives [Domain\User Name] like "Domain\PLuca" not actual user name "Patrik Luca". How to populate Actual User Name for e.g. "Patrik Luca"?

Patrik Luca, Ieper, BELGIUM
Feel free to use or spread all of the content on my blog. In return, linking back to my blog would be greatly appreciated. All my posts and articles are provided "AS IS" with no warranties.

Subscribe feeds via e-mail
Subscribe in your preferred RSS reader

Subscribe feeds rss Most Read Entries

Subscribe feeds rss Recent Entries

Categories

Recommended Books


Subscribe feeds rss Recent Comments

This Blog is part of the U Comment I Follow movement in blogosphere. Means the comment field of this blog is made DOFOLLOW. Spam wont be tolerated.

Live Traffic Feed

Recent Visitors

Blog Archive

My Blog List

Followers

Guest Links