function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jyotirupa DasJyotirupa Das 

How can I implement a functionality, where If I am trying to click a check box in VF page which is a webfor to create case, The Contact is automaticaly getting updated as Anonymous Contact in Case object.

I have a requirement where if I am selecting the check box while creating a case in VF page, User-added image

It should Populate the Contact name as Anonymous Contact in Case object.
User-added image

Can someone please provide me some guidance on this requirement
ShivankurShivankur (Salesforce Developers) 
Hi Jyotirupa,

You might want to go with a trigger on case object and update the case record based on the checkbox field value.

An example for the same can look like below:
trigger CaseCheckbox on Case (before insert) {
List<Case> CaseToUpdate = new List<Case>();
    for(Case cs: Trigger.new){
        If (cs.Checkbox__c == true){
           cs.Contact= 'Anonymous Contact Id';
           CaseToUpdate .add(cs.Id);
        }
    }
 update CaseToUpdate;
}
For more examples with different scenario to get help with code snippets, follow below link:
https://tekslate.com/15-sample-triggers-different-scenarios

Hope above information helps, Please mark as Best Answer so that it can help others in the future.

Thanks.