I am planning to do something like below:
- Create a custom detail page button to replace the save button.
- When user clicks the button to save a record it should execute the standard save method after setting certain additional fields on the object apart from the others set by users.
What will be the best way to do this without using visualforce page?
Attribution to: Anutosh Datta
Possible Suggestion/Solution #1
you could create a web-service that is called via javascript using the https://stackoverflow.com/questions/10354284/salesforce-executing-javascript-through-apex-controller
Attribution to: ebt
Possible Suggestion/Solution #2
Do you want to to override the standard 'Save' button for this?
You can simply write a 'before insert, before update' trigger that will do all field setting you need before saving the record into the database
Attribution to: Bao-Long Nguyen-Trong
Possible Suggestion/Solution #3
Another option would be to use a Workflow Rule to automatically set the fields in question automatically after the user saves the new record.
You can read more about workflow here: https://na7.salesforce.com/help/doc/en/creating_workflow_rules.htm
Attribution to: Benj
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/1449