• FrankCabreja
  • NEWBIE
  • 30 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies

Hi,

 

I have the following code that I would like to populate a date / time field to 2 hours after task creation date (in business hours).

 

This works fine if i set this to after or before update. but i need it to work upon insert of a new task.

currently it fires this error:

 

"Review all error messages below to correct your data.
Apex trigger calcBusinessHours caused an unexpected exception, contact your administrator: calcBusinessHours: execution of BeforeInsert caused by: System.MathException: null: (System Code)"

 

trigger calcBusinessHours on Task (before insert) {

BusinessHours stdBusinessHours = [select id from businesshours where id = '01m20000000LPVT'];

for (Task ta : Trigger.new) {
if ((ta.recordtypeid == '012M00000008bZY') && ta.status != 'completed' ){
// CL works 10 hours / day (8:00 AM - 18:00 PM, M-F). Our task SLA is 2 hours (2 business hours)
ta.SLA_Due_Date__c = BusinessHours.addGmt (stdBusinessHours.id, ta.createddate, 2 * 60 * 60 * 1000L);
}
}
}

 

Hi All,

 

I developed a web service and hosted over the web. I used the wsdl of this webservice to create an apex class in salesforce. I created a visual force page which will consume this apex class. So finally what i'm trying to do is access the webservice from vf page. But while doing this i'm getting the following error "System.CalloutException: IO Exception: Read timed out". I want to know the different reasons why this error occurs. Can anyone please help.

In my apex code, system.now() returns the current Datetime based on a GMT calendar. My aim is to get the date time value in my local time zone.Since we have day light saving, I didn't think  about manipulating the time difference.

 

I would appreciate your suggestions.

 

Under personal information, I have set the time zone as "Time Zone(GMT-05:00) Eastern Daylight Time (America/New_York)".

 

 

 

 

I have a webservice it runs fine, but it takes a while to get a response because it loads lots of data.

when it callout from an apex class from salesforce, it always return : System.CalloutException: IO Exception: Read timed out.

 

Is there a property to set the time out period of the salesforce?

How do we address this problem?

  • March 18, 2009
  • Like
  • 0