I've created a custom field of type DateTime in Task object.
I try to add to my custom field an object from type DateTime.
But I receive the following error message:
A value cannot be stored to my_custom_field in type Task
Here is the code:
Datetime now = Datetime.now(); Integer offset = UserInfo.getTimezone().getOffset(now); Datetime localTime = now.addSeconds(offset/1000); DateTime realEndTime = localTime; task.Scheduled_Timeframe__c = realEndTime;
Do you know how to solve and avoid this error?