Monday 22 June 2020

Business Hours for Assigning and re-Assigning

In every industry  auto assignment and re-assignment of  owners , will save lot of time for management .
In this process business hours will plays an important role. Now we will see how to calculate business hours .  
Use case 1: When lead is created the lead should assigned to particular agent, if the agent is not taken any action  with in the defined business hours (8hours) then the lead should assigned to an other sales agent . 

1. while creating lead we need to assign lead to sales agent .
2. While creating lead we will store the business hours in separate object  named CustomAssignments along with leadlookup and userlookup . if  we dont want user as lookup we can make user of owner of CustomAssignments .  
3.future dependent action on   CustomAssignments  for reassignment. 

 considerations :  standard assignment rules not considered because of complex assigenemtn and reassignment process . 
Created separate object  to store due-date/ re-assignment date with lookup of lead/other objects and lookup of user.  This helps in handling  future depend actions . 

use the following method  to get the business hours  while creating custom object . 
Business hours class : 

public class utility {
Public static BusinessHours bHours; 
public static datetime getBusinessHour(){
    if(bHours==null){
       bHours = [SELECT Id FROM BusinessHours WHERE IsDefault=true];  // name of your business hours   
    }
   return  BusinessHours.add(bHours.Id, Datetime.Now (), 32400000);// time in milli seconds 
      
    }

}

1 comment:

  1. Melbet Hotel, Casino & Brewery | Jordan7 Retropie
    Melbet Hotel, Casino & best air jordan 18 retro men red Brewery, Hotel & Brewery is air jordan 18 retro men the premier air jordan 18 retro men blue outlet destination in the Jordan jordan 18 white royal blue sale region for luxury, how to order air jordan 18 retro varsity red gaming, hotel accommodations and

    ReplyDelete