You need to sign in to do that
Don't have an account?
cmark
setting datetime field to "now"...
I want to update a record and set the value of a custom DateTime field to the current date and time (SFDC system date and time). So the equivalent of updating a field in Oracle and passing "now()" as the value. Is there a one-step way to do this? Or do I have to query the timestamp and the put it into the record that I'm updating?
Thanks
Chris
Thanks
Chris
You can do this with a workflow rule that updates your custom DateTime field whenever the record is updated or created. Just make the workflow field update change the value of your field to a formula defined as:
NOW()
It's not quite one step since you need to define the custom field and the workflow rule/action, but it doesn't take very long to set up -- I just did it myself in less than 5 minutes.
If you haven't used workflow rules before, take a look at Chapter 8 of the free e-book, "Creating On-Demand Applications," available at http://wiki.apexdevnet.com/index.php/Creating_On-Demand_Applications:_An_Introduction_to_the_Force.com_Platform.
It should give you a good overview.
Hope this helps,
Caroline Roth
Co-Author, "Creating On-Demand Applications"
Is it possible to send a dummy datetime as the value for the field and have the field defined as type formula that sets the field to NOW() if the new field value is not null?
Thanks
Chris
Appending to what Caroline said, workflow can have conditions... it doesn't have to trigger at every create or update. Additionally, default values can be defined by conditions in a formula. It's not really clear to me why your requirement can't be met with Workflow and formulas. Can you expand on your requirements? Also, explain what you've tried, the result, and why it didn't meet your requirments.
Thanks
chris