BusinessHours oBh = [SELECT Name,Id FROM BusinessHours where name='FR'];
datetime leaCreatedDate =DateTime.now();

Long slaSeconds =864000000;



Am getting error in the last debug statment.Please correct me

  • 2
    what you want to do here? Nov 17, 2016 at 11:06
  • This method does exist but you are using it incorrectly. BusinessHours method add() will return a DateTime. It is very unclear as to what you are trying to achieve here. Please elaborate and we can help.
    – TSmith
    Nov 17, 2016 at 11:18

1 Answer 1


The method .add is used for the BusinessHours class not for the BusinessHours object. You probably want to do something like.

BusinessHours oBh = [SELECT Name,Id FROM BusinessHours where name='FR'];
DateTime leaCreatedDate = DateTime.now();

Long slaSeconds = 864000000L;


DateTime slaTime = BusinessHours.add(oBh.id,leaCreatedDate,slaSeconds);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.