SharePoint Developer Center >
SharePoint Products and Technologies Forums
>
SharePoint - Development and Programming
>
SharePoint List Column which takes Date values from other column but does not change thereafter when the lookup column changes
SharePoint List Column which takes Date values from other column but does not change thereafter when the lookup column changes
- I am trying a create a column Stamped Due Date which looks up date values from Due Date column, but it should not change as Due Date Changes. I want Stamped Due Date as "initial Original date" and don't want users to enter both Due date and Stamped Due when they click "NEW TASK"I have tried created a Calculated Column for "Stamped Due Date" and used "[Due Date]" in the formula but then Stamped Due Date also changes when somebody edits "Due Date"Any Advice would be highly appreciated:
Answers
- Like Ashwin suggest, first create a column, you can create it in UI.
You can reference:
Create a list(http://office.microsoft.com/en-us/sharepointtechnology/HA100992481033.aspx) in the "Add a column to a list" section.
Choose "No" for "Require that this column contains information:", because you don't want the user to input it when create item.
Although these steps will create a column, this column can still be editable when edit the item. If you do not wish to let it be editable during creation or edition, you will need to create a list definition to hide it.
How to: Create a Custom List Definition(http://msdn.microsoft.com/en-us/library/ms466023.aspx)
Attach an event handler to the list, override the ItemAdded event.
ItemAdded :Asynchronous After event that occurs after a new item has been added to its containing object
Please reference:
How to: Create an Event Handler Feature(http://msdn.microsoft.com/en-us/library/ms453149.aspx)
Please also reference the user guide of VSeWSS1.1, it includes full tutorials on the topics:
Download details: VSeWSS11 User Guide, Samples and Walkthroughs
If you're not comfortable with coding, contact a local developer for help.
Keep It Simple and Stupid.- Marked As Answer byAshish Malhotra Friday, November 06, 2009 1:13 AM
- If you write event handler onItemAdded.. It will add a value in Stamped Due Date on Item Added.. It will not change Stamped Due Date when item is updated/modified.
For how to write event handler for onItemAdded please refer below links or Refer Charlie's reply..
http://msdn.microsoft.com/en-us/library/ms453149.aspx
Use below code under OnItemAdded()
public override void ItemAdded(SPItemEventProperties properties)
{
SPListItem item = properties.ListItem;
(if item[“Due Date”] != null)
{
item[“Stamped Due Date”] = item[“Due Date”].ToString();
item.Update();
}
}
Ashwin B. | My Blog | Twitter | E-Mail- Unmarked As Answer byAshish Malhotra Wednesday, November 11, 2009 4:48 AM
- Marked As Answer byAshish Malhotra Wednesday, November 11, 2009 4:48 AM
- Marked As Answer byAshish Malhotra Friday, November 06, 2009 1:13 AM
All Replies
- First Create a Column Stamped Due Date as Text/Date type
Write a Event Handler and trigger it on Item Added. Where in you will copy the value in Stamped Due Date from Due Date. So whenever you will edit the Due Date it will update the value of Stamped Due Date.
Ashwin B. | My Blog | Twitter- Edited byAshwin A. Bhagwat Wednesday, November 04, 2009 5:21 AMSpelling Mistake :(
- thanks for you reply Ashwin..
I didn't get how & where to write event handler on Item Added...
But I don't want Stamped Due Date to change when Due date is changed... - Like Ashwin suggest, first create a column, you can create it in UI.
You can reference:
Create a list(http://office.microsoft.com/en-us/sharepointtechnology/HA100992481033.aspx) in the "Add a column to a list" section.
Choose "No" for "Require that this column contains information:", because you don't want the user to input it when create item.
Although these steps will create a column, this column can still be editable when edit the item. If you do not wish to let it be editable during creation or edition, you will need to create a list definition to hide it.
How to: Create a Custom List Definition(http://msdn.microsoft.com/en-us/library/ms466023.aspx)
Attach an event handler to the list, override the ItemAdded event.
ItemAdded :Asynchronous After event that occurs after a new item has been added to its containing object
Please reference:
How to: Create an Event Handler Feature(http://msdn.microsoft.com/en-us/library/ms453149.aspx)
Please also reference the user guide of VSeWSS1.1, it includes full tutorials on the topics:
Download details: VSeWSS11 User Guide, Samples and Walkthroughs
If you're not comfortable with coding, contact a local developer for help.
Keep It Simple and Stupid.- Marked As Answer byAshish Malhotra Friday, November 06, 2009 1:13 AM
- If you write event handler onItemAdded.. It will add a value in Stamped Due Date on Item Added.. It will not change Stamped Due Date when item is updated/modified.
For how to write event handler for onItemAdded please refer below links or Refer Charlie's reply..
http://msdn.microsoft.com/en-us/library/ms453149.aspx
Use below code under OnItemAdded()
public override void ItemAdded(SPItemEventProperties properties)
{
SPListItem item = properties.ListItem;
(if item[“Due Date”] != null)
{
item[“Stamped Due Date”] = item[“Due Date”].ToString();
item.Update();
}
}
Ashwin B. | My Blog | Twitter | E-Mail- Unmarked As Answer byAshish Malhotra Wednesday, November 11, 2009 4:48 AM
- Marked As Answer byAshish Malhotra Wednesday, November 11, 2009 4:48 AM
- Marked As Answer byAshish Malhotra Friday, November 06, 2009 1:13 AM
- Thanks Ashwin and Charlie... you guys are Wonderful... I was successfully able to do it.....I really appreciate your Responses...And I guess would need your Intelligent advice from Time to time when I am stuck in SharePoint Development...
Hi Guys
I am trying to create a Date column which looks up date values from Training Date column for other Training Calendar list, but i an not able to see "Start Date column" or any other Date column from the lookup dropdown.
Thanks in advance.
Jim Patel


