How many times we can call Test.StartTest() and Test.StopTest() – Salesforce Apex Issue

How many times we can call Test.StartTest() and Test.StopTest() methods in test class? Generally Test.StartTest() and Test.StopTest() methods are used to create another set of governor limits in a method. With this we can get rid of limits issues in test classes. As we are checking positive and negative scenarios by giving different inputs, we tend to reach the governor limits. So we write block of code in between Test.StartTest() and Test.StopTest() in the method and execute. Each test method is allowed to call these methods once only. So, we…

Read More

System.now function is not working as appropriate – Salesforce Apex Issue

I am using system.now() in a controller in my application. Later I have so many calculations with it. But Date time calculations are not as per timezone of my client. Why? Solution: Yes. It will happens because, System.now() returns the DateTime in GMT time zone, whereas System.now().hour() and System.now().format() are the methods of DateTime class, which return the local time zone of current logged in user. But, one thing we have to find is that System.now() will return DateTime and all other methods of DateTime will be string. It means,…

Read More