locked
Block change a columns after start task RRS feed

  • Question

  • I have one Columns called upload date (start task) that that takes date = TODAY

    I need that this field can't be change by any user. So once the item is created this date should remain the same and should be fixed in a sense that the person can change the date for a different date after

    ___________________________________________________________________________________________________

    also I need to only allow one field to be change after a second field be typed 

    Like Posting status can only be changed by posted after information be available in document number. For this case is just create a simple workflow with condition right ? 

    Friday, May 16, 2014 1:37 PM

Answers

  • Hello Marina,

    For first issue, you can use created by column of list/library, which by default capture the current date in system and can't be modified by anyone (however can be changed via code but no way to change by API).

    For second issue, either you can hide that column until another column has some value OR you can create event receiver to restrict user to save any value in that column. If you create event receiver then you can also manage first point in same receiver by cancelling the event if someone tries to add/update data in column.

    WF will not help to restrict user to add/update any data in column.

    public override void ItemAdding(SPItemEventProperties properties) 
    {
        base.ItemAdding(properties); 
        if (add condition here) 
        {   properties.Cancel = true; 
            properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl; 
        } 
    }
    Hope it could help


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    Friday, May 23, 2014 10:22 AM
    Moderator

All replies

  • Can you not use the Created field value for this purpose? Do you want the value to be changed by any one(including admin) at any time?

    Thanks Sandy

    Friday, May 16, 2014 2:05 PM
  • Hello Marina,

    For first issue, you can use created by column of list/library, which by default capture the current date in system and can't be modified by anyone (however can be changed via code but no way to change by API).

    For second issue, either you can hide that column until another column has some value OR you can create event receiver to restrict user to save any value in that column. If you create event receiver then you can also manage first point in same receiver by cancelling the event if someone tries to add/update data in column.

    WF will not help to restrict user to add/update any data in column.

    public override void ItemAdding(SPItemEventProperties properties) 
    {
        base.ItemAdding(properties); 
        if (add condition here) 
        {   properties.Cancel = true; 
            properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl; 
        } 
    }
    Hope it could help


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    Friday, May 23, 2014 10:22 AM
    Moderator