Category: Summer15

Salesforce Summer 15 New Feature || Now we can use Location and Distance Variables in SOQL and SOSL Queries

With Salesforce Summer’15 release, now we can use location and distance variable in SOQL and SOSL queries.To know more about location and distance variable, I will request to check Salesforce’s documentation @Location-Based SOQL QueriesNow let me explain this new feature with a small code snippet.In my account object, I have created one custom field of type Geolocation with name Head Office Location (API Name: Head_Office_Location__c).Below is the code snippet -As you can see in the above code what I am trying to find all the accounts whose head office is located within 1 miles from my current location. To achieve this, I have used my current location’s latitude and longitude as apex bind variable in SOQL query.The way DISTANCE and GEOLOCATION function work are given below -DISTANCE(mylocation1, mylocation2, ‘unit’)GEOLOCATION(latitude, longitude)Now after Summer’15, you can replace any of the parameters used in the above two functions by apex bind variable.So to me, it is really a good feature. What do you guys think? Please provide your feedback....

Read More

Salesforce Summer 15 New Feature || Predictable Iteration Order for Apex Unordered Collections

After Summer15 Salesforce release, the order of elements in unordered elements (Map and Set) is always the same. Previously the order was arbitrary and as a developer, you have no control on the order.Now as you can see, with this new feature, we are trying to order the unordered elements. A little strange to me. But if you have some code snippet, where the logic depends on the ordering of the elements, then this new feature will be really helpful.Let’s consider the below code snippet -If you run this code after Summer15, you will get the elements in the same order every time you execute.21:01:19.145 (145215707)|USER_DEBUG|[10]|DEBUG|Index: 1 Employee: James21:01:19.145 (145338304)|USER_DEBUG|[10]|DEBUG|Index: 2 Employee: Sudipta21:01:19.145 (145498650)|USER_DEBUG|[10]|DEBUG|Index: 3 Employee: Christiaan21:01:19.145 (145587990)|USER_DEBUG|[10]|DEBUG|Index: 4 Employee: VictorSo now your Unordered Collections are also...

Read More

Salesforce Summer 15 New Feature || New way to calculate code coverage for multiline statements

In Summer 15 release, Salesforce changed the way to calculate code coverage for multiline statements. As a developer, you feel good in some situation and bad in some situations. In this post, I will explain both the situations.Let me first explain the change -If a single statement is broken into multiple lines, then each line will be considered now while calculating the code coverage. To be more precise, each line that contains an expression will be considered while calculating code coverage. Before Summer 15 release, multiline was considered as a single line.To explain more, I will start with a simple code snippet.Situation 1 – Happy Situation:Consider the below code snippet.Now say for example, you have written unit test methods for the methods calculateDistanceBetweenAB(), calculateDistanceBetweenBC(), calculateDistanceBetweenCD() and calculateDistanceBetweenDA().You have also written test methods to cover line# 8,9 and 10. The only line which is not covered/tested is line# 11.Now before Summer 15 release, the way in which code overage was calculated -Total number of lines = 4 (line # 3,8,9 and 11)Total number of lines covered = 3 (line # 3,8 and 9)So the code coverage = 3/4 i.e. 75%But after Summer 15 release, the way in which code overage will be calculated -Total number of lines = 7 (line # 3,4,5,6,8,9 and 11)Total number of lines covered = 6 (line # 3,4,5,6,8 and 9)So the code coverage = 6/7...

Read More

Earlier Posts

  • 2024 (25)
  • 2023 (47)
  • 2022 (25)
  • 2021 (35)
  • 2020 (41)
  • 2019 (13)
  • 2018 (16)
  • 2017 (14)
  • 2016 (18)
  • 2015 (74)
  • 2014 (20)