Questions tagged [businesshours]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
11
votes
2answers
5k views

Set Business Hours in Apex Test Code

I have written a class to calculate business hours for Case age in business hours. The class works great my issue is when trying to write decent test code for the class. In following testing best ...
18
votes
1answer
3k views

Creating Holidays and Business Hours in Test Code

I have been creating a Business Hours Calculation engine in the past few weeks and have gotten some great help on a few questions I've already asked (BH in Apex, BH and Holiday Affiliation). I have ...
0
votes
4answers
22k views

How can I get my correct current local time?

I need to get the current time but to be in type DateTime. I use: DateTime now = System.now(); but it returns wrong time. I execute the code in 2017-08-04 00:38:46 AM but it returns 00:38:46:023 ...
11
votes
1answer
3k views

Business Hours and Holiday Affiliation

I have been in the process of creating a Business Hours Engine that calculates business hours. I have used the Case Flags product and like it, but I am looking to build a custom engine so I can take ...
5
votes
2answers
3k views

How to Calculate the Office Hours except holidays hours In Salesforce

I have the three field like below and I want to calculate the business hours but need to reduce the hour if the exist the holiday. I have write this code into the apex class and call this class form ...
3
votes
1answer
4k views

Calculating business days using BusinessHours class

Our business has a requirement to calculate a due date on a case by using the created date and adding business hours, or business days. When we calculate business days it converts the days to 24 hours ...
1
vote
2answers
905 views

Using BusinessHours.add for calculating a due date in a Datetime field

I found an Apex trigger that adds 9 business hours, and I'm looking to use it to add 16 business hours to the CreatedDate field on a case and put that new value into a custom Datetime field called ...