I'm just doing this using the Salesforce Lightning GUI, not doing it programmatically.

I am creating a new field for a Salesforce object. This field will hold multiple datetime stamps. When an event occurs, a datetime stamp will be appended to the field. It will effectively be a list of datetime stamps. I am confused as to which data type to use.

I am not sure that either date or date/time will capture multiple datetime stamps: enter image description here

I suppose I could just use an open ended text field, but as these are datetime objects, we would like to use these as such (to see when was most recent event, etc) instead of just a text field.

Any suggestions for the best way to do this?


You cannot have a list in a field, but instead you need to have a related list of objects that are children of the Salesforce object and that contain a single Datetime field.

For example, if your main object type is MyObject__c, you might have a new custom object called MyObjectTimestamp__c. This would have a Master Detail field referencing MyObject__c along with a Timestamp__c field of type Date/Time (which likely needs to be mandatory).

When the specific event occurs you simply create a new MyObjectTimestamp__c record, referencing the MyObject__c record for which the event occurred and setting the Timestamp__c field to "now".

This could be done in an "after update" trigger or via a flow or process builder as you see fit.

BTW, taking this approach means you can later add extra fields to the timestamp allowing more information to be recorded as well.

All the timestamps can be shown on the layout in a related list. It is even more flexible in Lightning Record Pages since you can use the single related list control in the page, and if using Dynamic Forms even interleave this with other data in the main Salesforce object's details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.