function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Problem while Updating BusinessHours Field in Case

I'm trying to update the BusinessHours field in Case based on some conditions.
I'm assigning businessHours Id value fetched from the Organisations Business Hours to this field.
Its throwing an error saying 'Illegal Assignment Id to SObject:BusinessHours'.
Is there any way to do this.
I read in the 'Apex Language Reference ' document that we cannot perform DML operations on this object.
But im updating the case not that object. Is it possible using apex?
Any pointers will be of great help.
Thanks in advance.



We have hit this problem as well.


We are trying, using APEX code, to set the business hours on a Case object. we have tried setting this using the business hours Id, and using setting the business hours to the business hours object itself. Without success.


Any guidance would be appreciated!


thank you.