Skip to main content

Questions tagged [businesshours]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
37 views

Business Hour Time zone should we have to change in every day light savings time

If timezone is changed in "Company Information" for a Salesforce Org (Org-Wide Time zone) in a particular Day Light Savings Time(Suppose November 3, 2024), then a particular Business Hour ...
vinesM's user avatar
  • 1
0 votes
0 answers
49 views

Can you help me using a Salesforce sample formula to get business hours between two date/time fields please?

I've been following this Salesforce documentation but it's not working. I have a TimeLeft formula field that needs to calculate business hours between two dates. I mean, from NOW() to the due date ...
kat's user avatar
  • 3
1 vote
1 answer
61 views

BusinessHours.add() returning GMT instead of local

I am testing add() method from BusinessHours class and am getting an unexpected result. As per documentation: Adds an interval of time from a start Datetime traversing business hours only. Returns ...
Arthlete's user avatar
  • 4,957
0 votes
1 answer
136 views

How do I find the relationship between BusinessHours and Holiday?

As far as I understand, the junction object is hidden by Salesforce itself. I found an answer that advises to link objects by their names: BH : USA; Holiday : USA - New Year But in this case we will ...
Max Vitko's user avatar
0 votes
0 answers
106 views

Salesforce Milestones Timer when changing Entitlement with different Business Hours

I have an interesting use case and I would like to tap into your expertise to see the best way to achieve this (without code 🫣). I'll try to keep it as simple as possible. We have two teams: ...
Paulo Duarte's user avatar
-1 votes
1 answer
125 views

I have a requirement to check if date given on object is greater than today's but should be less than next 5 business days. How to apply that logic?

I am able to calculate easily if it is greater than today. setConditionalFormatting(){ if(this.myTaskWrappers){ this.myTaskWrappers = this.myTaskWrappers.map(item => { ...
SF Learner's user avatar
0 votes
1 answer
759 views

Deploying reports: columns-field: Invalid value specified: BUSINESS_DURATION

In my CI/CD pipeline, when I deploy from Org A -> version control -> Org B after developing a report in Org A, I get the following error for the report in question columns-field: Invalid value ...
cropredy's user avatar
  • 72.1k
0 votes
0 answers
197 views

Milliseconds issue, how convert 00h to 24, 01h to 25, 02h to 26..?

I have a LWC component that is a calendar, he verify the begin and end time of the company to put the interval of this hours, the problem is, when the hour is 00 or 01 or 02.. because of the way that ...
Alexia's user avatar
  • 83
0 votes
0 answers
889 views

Calculate business hours between case creation and closing date (Mon-Fri 9am to 5pm)

I want to calculate the total number of business hours it took to close the case. The working hours are Monday to Friday 9am to 5pm (8 hours a day). I wrote the following formula but it is giving ...
Marjan's user avatar
  • 15
0 votes
1 answer
548 views

Operating Hours Holidays causing deployment error for BusinessHours.settings

We are implementing Salesforce Scheduler and have encountered a serious issue with our automated deployments following the implementation of the Operating Hours Holidays functionality. When these ...
Callum MacErlich's user avatar
2 votes
1 answer
669 views

Does Date.addDays() method skip the weekends based on the Org's Business Hours settings?

For example when I use Date.addDays(1) for a task's due date. I realized if the next day falls into a weekend both Sat and Sun are skipped and it adds 1 workday (which is three days count). Now, this ...
Bahman.A's user avatar
  • 868
0 votes
2 answers
215 views

Mocking BusinessHours records returns System.MathException: null

I am stuck on a test method and any help would be highly appreciated. To provide some context: I created a method that queries a specific BusinessHours record on the DB and validates if a Case was ...
user1067017's user avatar
  • 1,017
1 vote
1 answer
3k views

When calculating business hours between two dates, value is rounded to whole number

I have a formula field that calculated the difference in business hours between two dates from field MQL_Response__c and field MQL_Created__c. The hours are calculating correctly, but it rounds to a ...
Jeff's user avatar
  • 11
2 votes
0 answers
403 views

Remaining place in queue after closing hours in Salesforce chat

I'm setting up a chat solution for a firm right now, where they have opening hours for their chat service. The chat would tipically be open from 08:00-16.00. After closing hours, no customers should ...
Nonya's user avatar
  • 39
0 votes
1 answer
2k views

Number Formula - Two Date/Time Field Difference Within Business Hours

I have a formula field (FirstCallDif__c) that shows in minutes the difference between two fields: (FirstCall__c - CreatedDate) *24*60 This gives us the minutes however some leads do come in at say ...
Craig Phoenix's user avatar
1 vote
1 answer
2k views

Calculating Business Hours via Trigger and Class

I currently have business hours / Holidays removed from business hour calculations using formula fields. The issue with that is, is an employe works on a holiday or weekend, the formula shows a ...
Shawn's user avatar
  • 63
0 votes
1 answer
712 views

How to respond to Einstein Bot after-hours message during business hours?

Background A Facebook Messenger Einstein Bot has an business-hours check as the first action, if it is out of business-hours it sends a message informing them that no one is available. Question How ...
Robs's user avatar
  • 9,396
3 votes
1 answer
3k views

How to check if a Date is within Business Hours for Multiple TImezones

I am working on a requirement to update a field if the LastModifiedDate lies within the Business hours of the user, viz. Monday to Friday between 8 AM to 5 PM. I have tried using the BusinessHours ...
Hemant Jain's user avatar
  • 2,785
1 vote
1 answer
340 views

Long to Double Calculation Getting Rounded to Zero Incorrectly [duplicate]

I'm doing a fairly simple calculation to compute the difference in Business Hours between two DateTimes. This is largely functional, but in the case of short differences (~10 minutes) this gets ...
Todd Sprinkel's user avatar
0 votes
1 answer
213 views

BusinessHours methods not compiling

For some reason when I attempt to use the BusinessHours.isWithin method within Salesforce I get the following error: Compile failure on line 4, column 34: Method does not exist or incorrect signature:...
jonnybro's user avatar
  • 1,794
0 votes
0 answers
547 views

Salesforce formula to exclude holidays between two date time fields

I would like to create one formula field on Case object which calculates business hours between two dates. Weekends, as well as Holidays mentioned in Business hours, should be excluded in the formula. ...
Anurag Bhardwaj's user avatar
1 vote
1 answer
258 views

Test Class for Business Hours Check

I am trying to build a test class for my new trigger and part of the trigger is to check current time against the org business hours then set it as a boolean yes/no. Code: DateTime now =system.Now();...
Craig Phoenix's user avatar
1 vote
1 answer
174 views

Setting due dates for autogenerated cases

Based on a business days value (1 = business day 1, 12=business day 12) and taking account of the below I would like to generate a due date based on a created date. - Default business hours, - ...
Ross Richardson's user avatar
0 votes
1 answer
319 views

Trigger Run Outside of Business Hours

I have my simple trigger working now where once a threshold is met for cases created within 60 minutes it updates the "SendAlert" field so my workflow can start going to work. The next steps I am ...
Craig Phoenix's user avatar
0 votes
1 answer
2k views

how do i give permission of updating business hours to a normal user other than system administrator?

Is there a way we can give a normal user with the previlage of updating business hours and holidays in salesforce? Any supporting URL would be really helpful. Thanks in advance.
venky's user avatar
  • 417
0 votes
1 answer
1k views

Why is my entitlement not stopped during support holidays?

I have an entitlement process with a single milestone in it. I've created a support holiday and linked it to the business hours record I have set up on the milestone and on the entitlement process. ...
Valyrion's user avatar
  • 1,144
0 votes
1 answer
945 views

Business Hours calculation is incorrect/ not consistent for certain dates

My use case is to calculate the deadline to respond on the Case. Rule is to add 10 business days from the complaint received date. Defined the business hours: Logic 1 Date initialDate = ...
indrasen neelam's user avatar
3 votes
1 answer
430 views

Businesshours.nextStartDate is returning value which is on a holiday

In our org, I have set-up business hours as 08:00-16:00 and timezone is GMT +2. Saturdays and Sundays are blank which means they are holidays. I then went in and set-up Holidays and have put the 24th,...
kt10208's user avatar
  • 93
6 votes
2 answers
1k views

Does SFDX add any way of automating the setup of business hours?

It wasn't (and I assume still isn't?) possible to programmatically set up business hours via Apex code in unit tests: Set Business Hours in Apex Test Code Creating Holidays and Business Hours in Test ...
Keith C's user avatar
  • 136k
0 votes
1 answer
978 views

Escalate case using business hours

We are using process builder to escalate a case and send email notifications to specific queues. The escalation works using scheduled actions...i.e. after 1 hour send email, after 2 send another email ...
Dman100's user avatar
  • 2,455
1 vote
1 answer
1k views

Business Hours difference calculation during BST

Hello I need help understanding how business hours difference is calculated with the Apex class. The documentation is rather poor and doesn't explain the input parameters assumptions. I found one post ...
user682217's user avatar
  • 1,171
1 vote
1 answer
521 views

Update action in x business hours

I have a requirement where I need to send email in 8 business hours. It should respect holidays and weekends. Example: Office Hours 8 AM to 5 PM If case is created at 4 PM Friday then email must be ...
Amit Trivedi's user avatar
2 votes
0 answers
2k views

BusinessHours.isWithin() Not Working As Expecting

I am using the BusinessHours class and am just running some basic tests: BusinessHours bh = [SELECT Id, ThursdayStartTime FROM BusinessHours WHERE IsDefault = true]; if (BusinessHours.isWithin(bh.Id, ...
Olivia's user avatar
  • 3,471
3 votes
2 answers
1k views

Does BusinessHours diff() method work with standard CreatedDate field in Before Update Trigger?

I will start off with a code snippet: trigger CaseTrigger on Case (before insert, before update) { BusinessHours defaultHours = [select Id from BusinessHours where IsDefault=true]; ...
Eduard's user avatar
  • 5,181
1 vote
1 answer
375 views

BusinessHours and scheduled dates

I am trying to create a payment schedule off of a input field DATE. If the date falls on a Weekend or on a Holiday then I want to move the payment date to the next open business day. I was using the ...
Olivia's user avatar
  • 3,471
1 vote
1 answer
59 views

Need to add only business days

In Opportunity i created a formula date field. in which i want only it take business days means like:TODAY() + ( ( ( 0.7 * ( Total_Payback_Amount__c ) ) - Total_Collected_to_Date__c ) / ...
Hennry's user avatar
  • 35
1 vote
0 answers
1k views

Create Test data within business hour and outside of business hours?

I have below code and for that I am trying to write the test classes. As per code look like Case should be created within Business hours and other condition says that, case should be created outside ...
Shanti's user avatar
  • 161
0 votes
1 answer
1k views

Add 5 Business days calculates wrong Target Date value in salesforce?

Business hours is set to 7 AM to 7 PM Mon to Fri, Time Zone (GMT-05:00) Eastern Standard Time (America/New_York). I need to simply add 5 working days from Current Date in order to calculate the ...
Sayali Shinde's user avatar
1 vote
1 answer
753 views

BusinessHours API not returning correct isWithin() value

I'm trying to use APEX BusinessHours class to check whether a certain Date is a Business Day or Not. Here is my Business Hour in my Organization: Based on this, if I provide following date input, it ...
VarunC's user avatar
  • 6,000
1 vote
1 answer
106 views

Hitting CPU Limit using BusinessHours

I am working on a method that adds business days using the BusinessHours class. Here is the method I'm working on: public static Date addBusinessDays(Date d, integer dayDifference, Id ...
Dman100's user avatar
  • 2,455
1 vote
1 answer
996 views

Find the next several days time according to business hours

I need to build a formula based on the start time, order type and business hours. start time and due time are datetime. The difficult part about this is I need to calculate this around the business ...
Lance Shi's user avatar
  • 13k
2 votes
1 answer
248 views

Apex Business Hours calculation glitch

I have a salesforce org with business hours set up from 8AM - 6PM (10 hours). Corporate holidays are on 25,26th Dec and 1st Jan. I'm using the standard apex method BusinessHours.add() to calculate ...
user682217's user avatar
  • 1,171
1 vote
1 answer
2k views

Business Hours and Time Zones (EDT vs EST?)

I have trigger code that is calculating the span between two Date/Time fields - respecting Business Hours - easy. Business Hours end daily at 5pm - and the Time Zone is set to EST (however we're ...
chris markiewicz's user avatar
0 votes
2 answers
4k views

Calculate No of working days difference between two dates?

This could be the very simple use case, but I am straggling to make this working. How we can find out the business working days difference between two dates ? I know 8/26/2017 is Saturday, next days ...
user avatar
-1 votes
2 answers
1k views

Method does not exist or incorrect signature: [BusinessHours].diff(Id, Time, Time) [duplicate]

I am working on the BusinessHours and I am getting the below error. I just want to calculate the no. of hours difference between MondayStartTime and MondayEndTime Method does not exist or incorrect ...
user4567570's user avatar
  • 1,636
-1 votes
1 answer
42 views

Incompatible element type Time for collection of Datetime for BusinessHours

I working to calculate the business hours from the Business day: List<BusinessHours> bhList = [SELECT FridayEndTime,FridayStartTime,Id,IsActive,IsDefault,LastModifiedById, ...
user4567570's user avatar
  • 1,636
3 votes
4 answers
55k 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 ...
sfdev's user avatar
  • 347
0 votes
1 answer
1k views

DateTime set to an hour earlier

I have an object of type Time startWorkingTime and object of type DateTime nextBusinessDay. I want to create new object of type DateTime based on startWorkingTime and nextBusinessDay. Here is my code:...
sfdev's user avatar
  • 347
1 vote
2 answers
2k views

BusinessHours class returns incorrect time difference

I am using business hours class to get the hours, minutes difference between when a lead is assigned to a user and when it is acted upon. The business hours are 7 AM to 4 PM from Monday to Friday, ...
codeinprogress's user avatar
0 votes
2 answers
141 views

Calculate hours based on Task priority

I need help to achieve the following: When a Task priority is changed by a particular user, I must set a fixed amount of REAL (non-working) hours in a custom field in the same Task. The purpose is to ...
sfdev's user avatar
  • 347