Lock "classification" property in a document

Hi, I have "Document" ItemType with a class structure. When I create a Document through the form, I want that it is possibile to choose the classification property only before first saving. If the user saves the Document, it should be not possible to change classification. How can I get this? Thanks Pierluigi
Parents
  • Hi Pierluigi, Yes this is possible. What you would do is typically check if the value before and after the update event are different. To do so, you need to pass the classification value to something that can be read after the process : This is requestState ! you could save a requeststate onBeforeUpdate
    RequestState.Add("classification", this.getProperty("classification");
    and read it on afterUpdate :
    string savedClassification= (string)RequestState[“classification”];
    Make sure you delete this value then
    RequestState.Remove("classification");
    RequestState.Clear();
    If this is different, just send back an Error, it will cancel the update process.
Reply
  • Hi Pierluigi, Yes this is possible. What you would do is typically check if the value before and after the update event are different. To do so, you need to pass the classification value to something that can be read after the process : This is requestState ! you could save a requeststate onBeforeUpdate
    RequestState.Add("classification", this.getProperty("classification");
    and read it on afterUpdate :
    string savedClassification= (string)RequestState[“classification”];
    Make sure you delete this value then
    RequestState.Remove("classification");
    RequestState.Clear();
    If this is different, just send back an Error, it will cancel the update process.
Children
No Data