views:

37

answers:

2

I have a sharepoint custom list which has 5 columns ..the user should fill in first three columns and the other two should be locked for filling ..when the user enters the items and start the workflow if the workflow gets approved the 3 columns should be locked for editing and then the other two should be available for editing .

Can someone please tell me how can i achieve this.

Thanks

A: 

You'd need to implement either custom field types for the columns you're describing, or implement an event handler on the list with custom logic. Alternatively, you could implement a custom edit form for the list with the business logic for exposing fields as editable baked in, but you would need to ensure that your users do not alter field values via other means (external applications, data sheet view, etc.).

No out of the box fields support this, nor are there any list settings to enable such a scenario.

OedipusPrime
Hello, Thanks for the reply...just want to know that can we create columns through event handlers..that is the event handler will lookup to workflow status and if it is approved then it will create two columns ...just an idea i am not sure whether this is possible ..so can we do such thingThanks
I doubt that creating a column with an event receiver will work. If you create a column, you are creating it for that specific list (or content type), not the individual item.
Paul Lucas
A: 

Below is the code..slo approval is the column name which has the workflow status..whenever it will be approved then the item won't be available for editing..but it's not working correctly...can you tell me what am i doing wrong

using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.SharePoint;

namespace StoppingItemDeletion { public class ItemdeletionPrevention :SPItemEventReceiver {

    public override void ItemUpdating(SPItemEventProperties properties)
    {
        SPListItem item = properties.ListItem;
        if (item["SLo approval"] == "Approved")
        {
            properties.Cancel = true;
            properties.ErrorMessage = "you cannot delete it now";
            item.Update();

        }


        }
}