You need to sign in to do that
Don't have an account?
Dave Stevenson
How to change field when Edit button clicked?
I added two custom fields to an object with history tracking, editStartTime and editStopTime. I want editStartTime to hold the time the 'Edit' (or 'New' or 'Clone') button was pressed for the object. When the 'Save' button is pressed, I can easily set editStopTime in an Apex trigger, but how do I get the editStartTime?
The editStartTime will be cached in the object being edited, and will only be stored in the database if the edit is saved. If an edit is cancelled, the times will be discarded. I do not plan to display the start/stop fields on any page layout. Their values will only be visible in the field history section for a record.
I want the solution to work globally, both desktop and mobile, and from any page that has a 'Edit', 'Clone', 'New', or 'Save' button (I think that's all the standard buttons, did I miss any?) for this object.
I am new to salesforce, and my experience with other development environments gives me pre-conceived notions about how to do this that do not seem to match up with salesforce. I have been reading about custom buttons, controllers, page layouts, etc., and I should be able to follow the related tutorials. I'd like direction on which specific steps I should take to implement my requirements. For example:
Must I create a custom Edit button (and New, Clone), or is there a way to hook a small bit of code into the standard button, perhaps by customizing the controller?
If the start/stop values will only be displayed in the field history section, do I need to add or modify any page layouts?
Please list the steps of the simplest solution you would implement.
Thanks.
The editStartTime will be cached in the object being edited, and will only be stored in the database if the edit is saved. If an edit is cancelled, the times will be discarded. I do not plan to display the start/stop fields on any page layout. Their values will only be visible in the field history section for a record.
I want the solution to work globally, both desktop and mobile, and from any page that has a 'Edit', 'Clone', 'New', or 'Save' button (I think that's all the standard buttons, did I miss any?) for this object.
I am new to salesforce, and my experience with other development environments gives me pre-conceived notions about how to do this that do not seem to match up with salesforce. I have been reading about custom buttons, controllers, page layouts, etc., and I should be able to follow the related tutorials. I'd like direction on which specific steps I should take to implement my requirements. For example:
Must I create a custom Edit button (and New, Clone), or is there a way to hook a small bit of code into the standard button, perhaps by customizing the controller?
If the start/stop values will only be displayed in the field history section, do I need to add or modify any page layouts?
Please list the steps of the simplest solution you would implement.
Thanks.
1) a field update workflow rule to set editStartTime when a record is created, and any time it's edited
2) a trigger to set editStopTime on insert or update
Trying that now.