You need to sign in to do that
Don't have an account?
lolly133
Can anyone help me with this trigger??
Hi All
Have created this trigger to create a in opt in trial record when the opt in checkboxs are changed on the contact..
Have created this trigger on the contact record but it doesnt seem to do anything.. have gone through the debug logs and it is being stepped through but nothing happens.. any help would be much appreciated.
trigger CreateOptInTrail on Contact (after insert, after update){
List <Opt_In_Trial__c> optToInsert = new List <Opt_In_Trial__c>();
for (Contact c : Trigger.new){
System.debug('Hello');
if (c.Channel__c != null ){
System.debug('Hello123');
Opt_In_Trial__c o = new Opt_In_Trial__c ();
o.Contact__c = c.Id;
o.Channel__c = c.Channel__c;System.debug('channel');
o.Email_Opt_In__c = c.Email_Opt_In__c;System.debug('Email');
o.Phone_Opt_In__c = c.Phone_Opt_In__c;System.debug('Phone');
o.Post_Opt_In__c = c.Post_Opt_In__c;System.debug('Post');
o.SMS_Opt_In__c = c.SMS_Opt_In__c;System.debug('SMS');
optToInsert.add(o);
}
}
Have created this trigger to create a in opt in trial record when the opt in checkboxs are changed on the contact..
Have created this trigger on the contact record but it doesnt seem to do anything.. have gone through the debug logs and it is being stepped through but nothing happens.. any help would be much appreciated.
trigger CreateOptInTrail on Contact (after insert, after update){
List <Opt_In_Trial__c> optToInsert = new List <Opt_In_Trial__c>();
for (Contact c : Trigger.new){
System.debug('Hello');
if (c.Channel__c != null ){
System.debug('Hello123');
Opt_In_Trial__c o = new Opt_In_Trial__c ();
o.Contact__c = c.Id;
o.Channel__c = c.Channel__c;System.debug('channel');
o.Email_Opt_In__c = c.Email_Opt_In__c;System.debug('Email');
o.Phone_Opt_In__c = c.Phone_Opt_In__c;System.debug('Phone');
o.Post_Opt_In__c = c.Post_Opt_In__c;System.debug('Post');
o.SMS_Opt_In__c = c.SMS_Opt_In__c;System.debug('SMS');
optToInsert.add(o);
}
}
Try this trigger code.
Best Regards,
Mithun.
All Answers
Try this trigger code.
Best Regards,
Mithun.