You need to sign in to do that
Don't have an account?
bkradmin
Simple Cross Object Field Update
I am very new to Apex. I am looking to write a trigger that will dynamically update a field on an Account page with the value of a field on a Contact page (where the contact belongs to that account). So, for example, the Accound field would be called "Vice President's Personal Number" and it would pull its value from the mobile number of the contact whose role matches "Vice President". I imagine this is a pretty simple trigger to write, but I can't find any examples of this to get me started.
I highly recommend you start reading the getting started guides of the Apex coding. You can find it here:
http://wiki.developerforce.com/page/Get_Started_With_Apex_Code
Now in terms of your example, here was something written quickly to match what you're asking (it may not compile depending on field names)
To explain whats happening.