Run formula only once on Salesforce custom Date/time field

1.2k views Asked by At

I was facing some time-zone related issue with custom date/time object on salesforce basically I am creating/updating that value via force.com api's from different application. And salesforce convert the date/time value on default TimeZone witch is GMT.

On Salesforce user/organisation setting I have different timezone (not in GMT it's GMT+5:30 IST) So every time when record is created its show the value in GMT not in GMT+5:30.

What I did to convert the custom date/time filed timezone into local/setting timezone I used a formula custom date/time field in Salesforce and use DATETIMEVALUE( Date_Time__c ) formula which gives me the local/setting timezone.

But the problem is it's keep updating the value and I want this only that time of creation of object. After doing some re-search on salesforce found some formula where they are using AND and OR to achieve this but for me all of them not working because I want date/time object in return not boolean.

If you have any idea please let me know ...

1

There are 1 answers

1
Alex On

If you only want the formula to be executed when the record is created, it sounds like the best solution would be to put this formula in a field update. More information on those here.

To do this, you would create a date/time field (not formula). Then create a field update that fires when a record is created. If you don't want users to be able to edit the field later, make it read only.