+ Start a Discussion

Code for Trigger on Parent Account Required

Hi Folks
I require code for the following scenario.I have a custom object called Employment history.I need to:
Build a trigger which shoews the latests employment record  (latest active employment record = 'Contact_Employer' with a checkbox which says 'Active') and adds this value to the parent account field
Ensure this field isn't visible to standard users
Ensure this field is wiped if their employment history is deleted or if all records are set to inactive.

Any ideas?

Many thanks 
Ive been supplied this code so far. Is this anywhere close?

trigger PrimaryAccount on Account (before update, before insert) { 
//Set of Account Ids 
 for(Account fcon : Trigger.New)
    if(fcon.DRM_Active_c != TRUE)
        fcon.DRM_Contact_employer = fcon.ParentId;

Any help greatly appreciated guys and gals