Skip to main content
Hi,

 

I need some help.

 

I have a picklist which I used as a "Status"

 

The values are "Survey", "Design" and "Implementation".

 

I have mulitple fields that I would like to lock based on the status.

 

Example, Design Date will be lock when Status = "Survey" or "Implementation.

 

I tried and found that I can lock record but I would like to lock some fields in some section based on the stage.

 

Thank you in advance.
3 件の回答
  1. 2018年6月18日 6:34
    Hi Kevin,

     

    Create a new record type on that Object for which you will make the desired fields locked (like Design Date). When we select the Status field as Survey or Implementation, the below trigger changes the record type to make the Design date read only or locked. You can give more conditions, but if so, you will have to create more record types accordingly if you desire to make more than one fields locked based on the condition.

     

    trigger changeRecordtype on <objectName> (before insert,before update) 

     

    {

     

      for(<objectName> on:Trigger.new)

     

      {

     

        if(on.Status ='Survey' || on.Status ='Implementation' )

     

        {

     

        

     

         on.recordtypeId='<recordTypeId>';

     

        }

     

      }

     

    }
0/9000