I am thinking that your requirement is when record is create then it check any custom field value and if this field is not null then another custom field of checkbox type should set to true and for this i write code considering account object to perform task.
trigger createAccountRecord on Account (before insert) {
if(trigger.isInsert && trigger.isbefore){
accountHelperClass.accCheckBox(trigger.new);
}
}
public class accountHelperClass {
public static void accCheckBox(list<Account> accList){
try{
for(account accObj:accList){
if(accObj.Total_Rating__c == null){
accObj.CustomCheckBox__c = true;
}
}
}catch(exception e){
system.debug('get error message ==>'+e.getMessage()+' in line number ==> '+e.getLineNumber());
}
}
If you find your Solution then mark this as the best answer.
I am thinking that your requirement is when record is create then it check any custom field value and if this field is not null then another custom field of checkbox type should set to true and for this i write code considering account object to perform task.
trigger createAccountRecord on Account (before insert) {
if(trigger.isInsert && trigger.isbefore){
accountHelperClass.accCheckBox(trigger.new);
}
}
public class accountHelperClass {
public static void accCheckBox(list<Account> accList){
try{
for(account accObj:accList){
if(accObj.Total_Rating__c == null){
accObj.CustomCheckBox__c = true;
}
}
}catch(exception e){
system.debug('get error message ==>'+e.getMessage()+' in line number ==> '+e.getLineNumber());
}
}
If you find your Solution then mark this as the best answer.
I am thinking that your requirement is when record is create then it check any custom field value and if this field is not null then another
custom field of checkbox type should set to true and for this i write code considering account object to perform task.
If you find your Solution then mark this as the best answer.
Thank you!
Regards,
Suraj Tripathi
All Answers
Try Below Trigger Please Mark It As Best Answer If It Helps
Thank You!
I am thinking that your requirement is when record is create then it check any custom field value and if this field is not null then another
custom field of checkbox type should set to true and for this i write code considering account object to perform task.
If you find your Solution then mark this as the best answer.
Thank you!
Regards,
Suraj Tripathi