You need to sign in to do that
Don't have an account?
Antje
Apex Trigger Not Working :(
Hi Everbody,
I am new to apex, so please be patient. This is my first try at coding. Any help I could get is very much appreciated. I created a custom object (DataTable). This object does not have any parent/child relationships. I am trying to "copy" some information from Tasks into this custom object if the Task is related to an Opportunity. For now, all I want is to populate a field ( called TaskSubject__c) in my custom object that is equal to Subject on the Task/Activity object. Thank You! Here is what I got....
trigger AutoCreateDT on Task (after insert) {
for (Task t : Trigger.new) {
// Check if Task is related to Opportunity
if (t.what =='Opportunity') {
//Populate task subject in custom object called DataTable
DataTable d = new DataTable ();
d.TaskSubject__c = t.subject;
}
}
}
I am new to apex, so please be patient. This is my first try at coding. Any help I could get is very much appreciated. I created a custom object (DataTable). This object does not have any parent/child relationships. I am trying to "copy" some information from Tasks into this custom object if the Task is related to an Opportunity. For now, all I want is to populate a field ( called TaskSubject__c) in my custom object that is equal to Subject on the Task/Activity object. Thank You! Here is what I got....
trigger AutoCreateDT on Task (after insert) {
for (Task t : Trigger.new) {
// Check if Task is related to Opportunity
if (t.what =='Opportunity') {
//Populate task subject in custom object called DataTable
DataTable d = new DataTable ();
d.TaskSubject__c = t.subject;
}
}
}
All Answers
Thank You very much! This seemed to do the job. I most certainly apprecite you helping me out.