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
Priya MishraPriya Mishra 

senario

Hi All,

A senario:
I have a contact object and case object and i have a checkbox field in the contact object so when the checkbox is checked in the contact object  a vf page with some detail in the page should show in the case record for the contact type= employee. how can i build is logic in salesforce. your help will be much appreciated. thanks in Advance. 
Rahul Chaudhary OfficialRahul Chaudhary Official
contact to case is a one to many scenario

You can have a Trigger on Contact object in the After section

Assuming contact type is a custom field on Case
 
List<Case> c2u=new List<Case>();
for(Contact c : Trigger.New) {
   if(c.CHECK_BOX==true) { 
        List<Case> cases = [Select contact_type__c From Case where ContactId = c.Id];
       for(Case cc: cases) {
        cc.contact_type__c='Employee';
        c2u.add(cc);
       }
   }
}
if(c2u.size()>0) { update c2u;}

 
Priya MishraPriya Mishra
Thanks for the reply but the senario is:

If the checkbox field in the contact object is checked A alert in the case object should show as a inline vf page in case object.


 
Rahul Chaudhary OfficialRahul Chaudhary Official
ok can you give me a snop shot or something to help this understand better. Because i am not clear what do you mean by an alert or visual force page.