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

Long slaSeconds =864000000;

system.debug('oBh<<'+oBh.id);

system.debug('oBh<<'+oBh.add(oBh.id,leaCreatedDate,slaSeconds));

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

2
  • 2
    what you want to do here? – Tushar Sharma Nov 17 '16 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 '16 at 11:18
0

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;

system.debug('oBh<<'+oBh.id);

DateTime slaTime = BusinessHours.add(oBh.id,leaCreatedDate,slaSeconds);
system.debug('oBh<<'+slaTime);

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.