You need to sign in to do that
Don't have an account?
gtuerk
Using Dynamic DML to set DateTime fields
I am using the sObject.put() method to dynamically set fields for update based on user interaction with tasks. I'd like to be able to set DateTime value of Now() to be used in this field update. Is there a (n easy) way to do this?
Here's my snippet
public SObject doFieldUpdate(String fieldName, String fieldValue, SObject sobj){
sobj.put(fieldName, fieldValue);
return sobj;
}
And what I'd like to do is either overload this method or switch in the method body to set a DateTime field's value to Now() when this is run.
Best Answer chosen by Admin (Salesforce Developers)
gtuerk
easy enough to do as SObject.put() takes any, any. So I just used System.DateTime.now() as the 2nd argument