Skip to main content
34 events
when toggle format what by license comment
Jun 15, 2020 at 8:11 history edited CommunityBot
Commonmark migration
Sep 7, 2015 at 10:57 vote accept SFDC Wolf
Sep 5, 2015 at 2:45 comment added martin @SFDCWolf I had to make a few changes, but yes, it works.
Sep 5, 2015 at 2:43 history edited martin CC BY-SA 3.0
Another example
Sep 4, 2015 at 9:09 comment added SFDC Wolf by the way, did you try the code with business hours in your dev org ? status is updated to working?
Sep 4, 2015 at 9:08 comment added SFDC Wolf Here @martin ,we have our business hours defined by us lets say 9am to 5 pm and weekends off ! So that's how we have defined and yes they are defined correctly. Also, in the present code, a value is being passed to variable , I have checked debug logs also but still the requirement is not met.
Sep 4, 2015 at 8:19 history edited martin CC BY-SA 3.0
deleted 20 characters in body
Sep 4, 2015 at 8:06 comment added martin @SFDCWolf by the way, the default business hours are 24/7. Do you have the business hours set correctly in your test environment?
Sep 4, 2015 at 7:52 history edited martin CC BY-SA 3.0
added 106 characters in body
Sep 4, 2015 at 7:50 comment added martin @SFDCWolf so it's 48 business hours then. right?
Sep 4, 2015 at 7:43 comment added SFDC Wolf Here, @martin, in your updated answer is what I have already implemented, but here the most important thing about this requirement is to consider org defined business hours and that's the reason I had to go for business hour methods.
Sep 4, 2015 at 7:35 comment added martin @SFDCWolf I've updated my answer.
Sep 4, 2015 at 7:34 history edited martin CC BY-SA 3.0
added another example
Sep 4, 2015 at 7:14 comment added SFDC Wolf The requirement is very clear @martin , Once a case is closed and if customer replies back via mail with in 48 hours of closed date then the status has to be updated to working again.
Sep 4, 2015 at 7:07 comment added martin @SFDCWolf What do you want the trigger to do?
Sep 4, 2015 at 7:01 comment added SFDC Wolf I did include trigger.new as in for loop as mentioned, I'm still digging where is it going wrong !
Sep 4, 2015 at 6:55 comment added martin @SFDCWolf Yes. If you want the trigger to perform some action based on the records that are currently the target of some DML operation, you should use the trigger context variables.
Sep 4, 2015 at 6:43 comment added SFDC Wolf For(emailmessage em :trigger.new) , this is what you are talking about @martin ?
Sep 3, 2015 at 13:16 comment added martin One of the problems is that you are querying one particular case instead of acting on all of the records in a trigger context variable, i.e. trigger.new.
Sep 3, 2015 at 7:04 comment added SFDC Wolf Code posted as answer above!
Sep 3, 2015 at 6:57 comment added SFDC Wolf Hi Martin, I dont understand why it doesnt work, I'm getting the l value in system.debug() but the field update isn't working 'trigger , Can you try this in your dev org ?
Sep 2, 2015 at 12:48 comment added martin @SFDCWolf nice! glad to help.
Sep 2, 2015 at 12:47 comment added SFDC Wolf I got the code to run now and I hope its working now, yet to test its functionality to determine the method is correct, it is associated with case email repllies, so still testing the scenario ! Thanks Martin! :) Creating an instance of start date and end date solved the error BTW !
Sep 2, 2015 at 7:40 comment added martin @SFDCWolf You might have to be more specific on how it doesn't work. I've updated my answer with with a working example that uses the Case ClosedDate field instead of constructing a new DateTime.
Sep 2, 2015 at 7:36 history edited martin CC BY-SA 3.0
closed date instead of created date
Sep 2, 2015 at 7:29 history edited martin CC BY-SA 3.0
Another example
Sep 2, 2015 at 6:50 comment added SFDC Wolf I have not missed bussiness hours.diff(), Also I have converted 48 hours to milliseconds, the above method i.e, BusinessHours bh = [SELECT Id FROM BusinessHours WHERE IsDefault=true]; Datetime startdate = Datetime.newInstance(2013, 5, 28, 1, 6, 8); it runs, but doesn't work for me , here the start date is supposed to be the date time field(Closed date) from case object , any idea how to use here ?
Sep 1, 2015 at 13:45 comment added martin @SFDCWolf Also, make sure you convert 48 from hours to milliseconds.
Sep 1, 2015 at 13:32 comment added martin @SFDCWolf it could be that you were missing the BusinessHours. before the diff() method.
Sep 1, 2015 at 13:29 history edited martin CC BY-SA 3.0
Added a working example
Sep 1, 2015 at 13:22 comment added SFDC Wolf Yep! "Method does not exist" for any method mentioned in the link ! I strongly feel there is something else has to be done, I have my business hours defined in the org already !
Sep 1, 2015 at 13:19 comment added martin @SFDCWolf The same error?
Sep 1, 2015 at 13:15 comment added SFDC Wolf Thanks for the quick response Martin, I have written query already ! Still am getting the error! All the needful is done ,as per the info provided in the link.
Sep 1, 2015 at 13:10 history answered martin CC BY-SA 3.0