views:

5024

answers:

4

i have a sharepoint list

with 2 users for examole (user A and user B)

i need a calculated field in the list items such that if user "A" created the item the field vaule will be "X" and if user "B" created the item fields value would be "Y"

but i couldnt use [created by] in the furmiula of the calculated field !! why is that ?!! and is there another way to do what i need to do ?!

A: 

I believe you can create a text field that has the default value set to [Me] which should then be usable in a calculated field.

Bryan Friedman
A: 

For more complicated formulae (i.e. anything with conditional logic), try creating an event handler for the content type (or doc library). This will allow you full control to set the fields to what you desire.

The field can be hidden from the user inside the edit screens.

Make sure use the STSDev from codeplex to setup the solution for deployment.

Nat
+5  A: 

If using Sharepoint Designer is an option you can create a workflow for that list. Set it to start when a new item is created -or- edited, use a condition of "If Created_By equals ..." and an action of "Set yourfield to yourvalue", then add an Else If branch and repeat. This will always override anything a user enters in "yourfield". Takes about 2 minutes to do all of this.

barryd
Great idea, much easier than an event handler.
spoon16
A: 

Problems with Calculated fields you should note this-> Probleme mit dem Abfragen von Berechneten Feldern ? -> http://www.schonebeck.net/?p=5

David Schonebeck