+ Start a Discussion
Ummang JainUmmang Jain 

trigger question

Hey im new to trigger im struck on the question
Create a tracking object which records deletion/ Updation /Addition of student object.(e.g Associated with class, unassociated , Deleted ,Email , Dob , Phone , Name field updated). Record both Old value and New Value.
Kevin CrossKevin Cross
What part are you stuck on?
In summary, this would be an insert, update, and delete trigger.  Trigger.New and Trigger.Old contain a list of the old and new objects as well as Trigger.NewMap and Trigger.OldMap -- at least for updates and deletes.  For inserts, you only have the new versions for obvious reasons.  Therefore, you potentially will want to make use of Trigger.isInsert.  Depending on how you are trying to audit the changes (i.e., in one row with all the changes in one column like XML or JSON versus one row per change), you either loop through the list of changes.

I hope that gets you started then please post back specific question, so we can help you learn.

Ummang JainUmmang Jain
Hey kevin, Thanks for your help see the scenario is Class in a custom object which is parent while student is custom object which is child of class I need to create a Tracker custom object which should give information whenever if an record(data) is inserted that is new student is inserted or its association is removed or changed from the class as well as its mentioned field Name, DOB, Phone, Email are updated or changed tracker object should track these changes and show
Kevin CrossKevin Cross
What is the code you have so far?  What is the specific error or question you have with that code?