function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

trigger to make an update in a vf page



I have created a vf page named asset history. in that when i search a particular asset it shows me fields like asset name,status and contact name.


I want to write a tigger on the fields status and contact name such that whatever changes i make in these fields it should show me an entry of it in the vf page after i search that particular asset.


can someone please help me.




Where exactly you are getting the issue ? If you are updating the two fields you are talking about  then based on update you can fire the triggers. Triggers will work in the back and update what ever you want. Then when you are searching for the second time, you will get the updated record... Please let me know if I got the flow wrong.


Is there any reason why you wouldn't use field history tracking for this?  That automatically retains the changes that have been made to a field for a particular record.  If you want to include this on a Visualforce page, check out this thread, which has sample code to access the history table: