When you say last record, are you maintaining the record count using an autonumber? If yes - what you can do is use a after update trigger and get the record which was last created using the current value in the auto number -(minus) 1 - you can fetch this record and the value of the field you wish to have in the current record.
I have another query that how can i update field on mater object on the basis of the value of a field on detail object using trigger only (i.e. when i change the value of a field on detail objet then the status should change on master object). I have just started using salesforce few week ago. So plz help
The following thread has a code sample of a trigger where contact(detail) trigger updates the account(master) https://developer.salesforce.com/forums/ForumsMain?id=906F000000090cFIAQ
Please mark this as an answer if this resolves your issue so as to help others.
The following thread has a code sample of a trigger where contact(detail) trigger updates the account(master)
https://developer.salesforce.com/forums/ForumsMain?id=906F000000090cFIAQ
Please mark this as an answer if this resolves your issue so as to help others.