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
Radha Rathinavel PandianRadha Rathinavel Pandian 

record

Hi,

​My next requirement is, I have a list of record types A, B and C..... My case object checkbox wants to be enable default when the record type was A or B , orelse it should be unchecked...If I create a legal description for C..my checkbox want to be checked. How can I proceed this?
Amit Chaudhary 8Amit Chaudhary 8
Try to update your code like below
trigger LegalCheck on Legal_Description__c (after insert, after update) {
	List<Id> legalId = new List<Id>();
	for(Legal_Description__c lg : Trigger.new)
	{
		legalId.add(lg.Case__c);
	}

	List<Case> caseRecord = new List<Case>();
	for(Case c:[SELECT id,Check_Legal_Description__c,RecordType.name FROM Case WHERE id IN:legalId])
	{
		if(c.RecordType.name =='A' || c.RecordType.name =='B' ){
			c.Check_Legal_Description__c=false;
		}
		else if(c.RecordType.name =='C') {
			c.Check_Legal_Description__c=true;
		}
		caseRecord.add(c);
	}
	update caseRecord;
	
}

Let us know if this will help you
 
v varaprasadv varaprasad
Hi Radha,

Please check once following snippet code:
 
trigger updCheck on case (before insert) {

for(case cs : Trigger.new){
  if(cs.recordtype.name == 'A' || cs.recordtype.name == 'B'){
      caseCheck__c = True;
  }else{
     caseCheck__c = False;
  }

}
}

Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.

Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com

 
Radha Rathinavel PandianRadha Rathinavel Pandian
Hi VaraPrasad,

I want to check the box for inserting a new record also not only for record type A or B

trigger updCheck on case (before insert) { for(case cs : Trigger.new){ if(cs.recordtype.name == 'A' || cs.recordtype.name == 'B'){ caseCheck__c = True; }else{ caseCheck__c = False; } } }