- July 22, 2024
- iBirds Software Services
- 0
Summer 18 release notes my favorite
Hi, all today I am going to discuss some cool and new features provided by Salesforce in Summer 18 release notes. At the time of writing this blog, Summer18 release was in preview mode so we are not sure that all these will work exactly after full release.
- Switch Statement: Now apex provides the switch statement. The syntax is very much similar to Java.
Syntax:
switch on expression {
when value1 { // when block 1
// code block 1
}
when value2 { // when block 2
// code block 2
}
when value3 { // when block 3
// code block 3
}
when else { // when else block, optional
// code block 4
}
}
We can also use multiple values for a single block.
Ex.
When value1,value2{
//code block executes
}
If no when value match with expression then else block is executed, if no else block then no execution.
There is no break for the switch just like java. When a code block is executed, the switch block is automatically exit.
Apex switch statement expressions can be one of the following types.
Integer
Long
sObject
String
Enum
Example :
Integer age = 10;
switch on age {
when 10 {
System.debug(‘when age 10’);
}
when 18 {
System.debug(‘when age 18’);
}
when else {
System.debug(‘default’);
}
}
2.Apex code size limit increased:
The total amount of code you can use in your org is going to be increased from Summer 18, it will be 6 MB instead of 3 Mb. If your org was already approved for 6 MB then it will remain unchanged.
3.Speed up Apex Test Runs: Now we can speed up apex test runs if we do not want to collect the code coverage information during the test run.
It can be helpful in such case we are running our test class to check wheater it passes or fails for a condition.
What we need to do.
From Setup, search for Apex Test Execution. Choose Select Tests, and select Skip Code Coverage.
From the Developer Console, select Test | New Run | Settings | Skip Code Coverage.
4.The SOQL Count() Function Doesn’t Count (As Much) Toward Limits: In apex, we have governer limits against the total number of records we can retrieve in a query. Before Summer18 release, each individual record matches with count and count(fieldname) function was counted against the apex query row limit.
But From summer18 salesforce is going to simplify it. From now if a query using these functions returns an Integer, It will be counted as 1 query row for governer limit.
Let’s understand with some examples.
Integer noOfContacts = [SELECT COUNT() FROM Contact WHERE Account.Name = ‘iBirds Services’];
Before Summer18 the no of records matched by the query was counted towards query row limit. But now it will be counted as single query row.
Integer noOfContacts = [SELECT COUNT() FROM Contact WHERE Account.Name = ‘iBirds Services’];
If a query with COUNT(fieldName) function contains a GROUP BY clause, only the number of resulting AggregateResult objects count toward the limit. For example, in the query in the following
example, only one item per aggregated result is counted toward the limit.
List<AggregateResult> listOfAgrResult = [SELECT COUNT(id) FROM Contact GROUP BY AccountId];
5.Enable Debug mode for a user who really need it: As we know that Salesforce is slow in debug mode.In the previous release debug mode was an org-wide setting. But from summer18 we can enable debug mode for the particular user.
To enable debug mode for users in your org, go to the new Debug Mode Users page in Setup. Find the relevant users in the list, check the box next to their name, and click Enable. To turn debugging off, click Disable.
6.Component CSS Class Names Updated: This will affect the lightning component. The class name that uses double dash now uses single underscore instead of a double dash. ie.slds-p-around–small becomes slds-p-around_small.
7.lightning:insertImageButton : This component required minimum API version 43.0. This component adds an image button in the toolbar of lightning:inputRichText. You can use this component only as a sub-component of lightning:inputRichText component.
8.lightning:recordForm: Instead of using lightning:recordViewForm and lightning:recordEditForm , now we can use lightning:recordForm. We can set ‘mode’ attribute to view, edit or read-only to specify for which purpose we are using this form.
Ex. if we use mode= “edit” form will be like this.
9.Lightning:datatable supports mass inline editing: As we all know that lightning:datatable is a very powerful component to display record in a tabular format. Now it supports mass inline editing. We need to set editable property as true for a cell. 10.Enable Access to Metadata Without Enabling Access to Data(beta): If a user needs access to modify the metadata but not to access data. We can access Modify Metadata permission . Currently, this permission is not available in developer edition. Modify Metadata is enabled automatically when the Deploy Change Sets permission is selected . Let’s see an example: Previously a user need deploy change set and modify all data permission to deploy a change set. Now he does not need to modify all data permission. 11.Enter Internal Comments When Closing a Case: This is available in lightning experience only.While closing a case or creating a new one we can add internal comments.
12. Time field type is now generally available: time field type can be used when you just want to store time not date. i.e. Want to store hotel check in and check out time.
In lightning experience and salesforce1 mobile app , it displays as picklist.
Time field can be converted in Text and number.
Consideration before using a time field type.
You can’t add the field to records in automated flows created in Cloud Flow Designer or processes designed in Process Builder.
It isn’t supported in Schema Builder.
The time field type doesn’t support the creation of custom indexes for SOQL queries.
13.Rename Your My Domain When You Want: Yes now you can change my domain in salesforce without contacting to salesforce. How we can change my Domain: From Setup, enter My Domain in the Quick Find box, then select My Domain. Under My Domain Settings, select Edit. Enter a new domain name. Select Check for availability, and if the domain is available, select Save.
Thanks,