Starting from the specified target date returns the next date when business hours are open.
If the specified target date falls within business hours, this target date is returned.
Let say, you have specified the hours when your support team is available to serve your customers.
And there is Case open outside the business hours then what will be nextStartDate of your Business Hours? See below...
Syntax:
public static Datetime nextStartDate(String businessHoursId, Datetime targetDate)
The following example I am using System.Today() as a target date.
Sample Apex Code:
// Get the default business hours
BusinessHours busshrs = [SELECT Id FROM BusinessHours WHERE IsDefault = true];
// If it is within the business hours. The returned time will be in the local time zone
Datetime nextStart = BusinessHours.nextStartDate(busshrs.id, System.today());
System.debug('Next Business Hours Start Date is => ' + nextStart);
Example/Use Case:
Business hours for your Salesforce Org are 9 AM to 6 PM. So there are 2 results based on below:
1. If you execute the above code within the business hours, then it will return today's date.
2. If you execute the above code outside the business hours, then it will return next open business date.
Learning Pagination In Salesforce Is Not Difficult At All ! You Just Need 3 Easy Steps
How To Learn Get Field Values From Visualforce Page To Apex Class Controller Without Losing Your Mind
Main Difference Between ISBLANK And ISNULL in Salesforce
How To Get Total Amount Of Records Processed In Batch Job In 10 Minutes And Still Look Your Best
Export VisualForce Data into Excel Sheet in 3 Easiest Steps
7 Easy Steps to Generate Apex Class From WSDL In Salesforce
Simplest Way To Find Number of Days Between Two Dates in Salesforce
3 Easy Steps To Send Emails With Attachment From Your Apex Class In Salesforce
How Insert Comma In Formula Fields Can Help You Improve Your Productivity
Simple Guidance For You In Access Of Subquery Field Value Using Apex - Upwards Traversal.
Access Subquery Field Value Using Apex in 2 Easy Steps- Downwards Traversal
How Learning Enable Inline Editing In Visual Force Pages Could Save Your Money And Time
Enjoy! If you have any questions, comments etc. please feel free to let me know. As always, please feel free to get in touch me as I would be more than happy to assist you with any of your Salesforce development needs.
Latest Salesforce Interview Questions and Answers:
More Salesforce Blogs:
Check out Salesforce Daily Limit Only in 5 Simplest StepsLearning Pagination In Salesforce Is Not Difficult At All ! You Just Need 3 Easy Steps
How To Learn Get Field Values From Visualforce Page To Apex Class Controller Without Losing Your Mind
Main Difference Between ISBLANK And ISNULL in Salesforce
How To Get Total Amount Of Records Processed In Batch Job In 10 Minutes And Still Look Your Best
Export VisualForce Data into Excel Sheet in 3 Easiest Steps
7 Easy Steps to Generate Apex Class From WSDL In Salesforce
Simplest Way To Find Number of Days Between Two Dates in Salesforce
3 Easy Steps To Send Emails With Attachment From Your Apex Class In Salesforce
How Insert Comma In Formula Fields Can Help You Improve Your Productivity
Simple Guidance For You In Access Of Subquery Field Value Using Apex - Upwards Traversal.
Access Subquery Field Value Using Apex in 2 Easy Steps- Downwards Traversal
How Learning Enable Inline Editing In Visual Force Pages Could Save Your Money And Time
Enjoy! If you have any questions, comments etc. please feel free to let me know. As always, please feel free to get in touch me as I would be more than happy to assist you with any of your Salesforce development needs.
OR
You can Go to the URL and type (Change the salesforceinstancename with your salesforce org URL).
Go to : https://salesforceinstancename/apex/passparamFromVFtoController.
JavaScript Remoting is a framework or tool that front end developers can use to make an AJAX request from a Visual force page directly to an Apex controller. JavaScript remoting allows you to run asynchronous action by separating the page from the controller and to perform tasks on the page without having reloading the entire page.
JavaScript Remoting is the well-organized and competent way of calling the controller in an asynchronous manner and passing data in from the page, because you are sure that you are passing only that data which you need each time that you make a call.
Step 1: Create an Apex controller called AccountRemoterClass
global with sharing class AccountRemoterClass {
public String accountName { get; set; }
Visualforce.remoting.Manager.invokeAction(
<input id="accountSearch" type="text"/>
<apex:pageBlock id="block">
Below are the JavaScript Remoting Limits:
If your request requires more time to complete the transaction, then configure a longer timeout. You can setup it to 120 seconds.
Most of the interviewer asks the question, what is the maximum response size of your remote call ?
Answer is : maximum 15 MB.