Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
global class CalculateNextBusinessDate {
global class request
{
@InvocableVariable (label='Start Date' required = true)
global DateTime givenDateTime;
@InvocableVariable (label='Business Hours Id' required = true)
global String businessHoursId;
}
global class response
{
@InvocableVariable (label='Next Business Date')
global DateTime nextAvailableBusinessDate;
}
@InvocableMethod(label='Professor Flow | Calculate next Business Date' description='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.')
global static List<response> getNextBusinessDate (List<request> inputParams)
{
List<response> responseList = new List<response>();
DateTime nextDate;
if(inputParams != null && inputParams.size()> 0)
{
for(request pf : inputParams){
nextDate = BusinessHours.nextStartDate(pf.businessHoursId, pf.givenDateTime);
response rs = new response();
rs.nextAvailableBusinessDate = nextDate;
responseList.add(rs);
}
}
return responseList;
}
}
global class CalculateNextBusinessDate {
global class request
{
@InvocableVariable (label='Start Date' required = true)
global DateTime givenDateTime;
@InvocableVariable (label='Business Hours Id' required = true)
global String businessHoursId;
}
global class response
{
@InvocableVariable (label='Next Business Date')
global DateTime nextAvailableBusinessDate;
}
@InvocableMethod(label='Professor Flow | Calculate next Business Date' description='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.')
global static List<response> getNextBusinessDate (List<request> inputParams)
{
List<response> responseList = new List<response>();
DateTime nextDate;
if(inputParams != null && inputParams.size()> 0)
{
for(request pf : inputParams){
nextDate = BusinessHours.nextStartDate(pf.businessHoursId, pf.givenDateTime);
response rs = new response();
rs.nextAvailableBusinessDate = nextDate;
responseList.add(rs);
}
}
return responseList;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.