Apex/Visualforce New Features & Changes – #Winter19 Development Track Highlights

Apex/Visualforce New Features & Changes – #Winter19 Development Track Highlights

Yep, #Winter19 is here and it brings a lot of new features with it. In this post, let’s discuss a few of the new and changed features in Apex & Visualforce.

Read complete #Winter19 release docs here.

#1 APEX Features – Salesforce has introduced a few new features and enhancement for Apex. I have highlighted few of them here:

1. Inherited Sharing – “With Sharing” and “Without Sharing” have got a new sibling 👨‍👨‍👧 😆

Now you can use “Inherited Sharing” in a class signature. This sharing keyword will give you the flexibility to run your apex code with both with or without sharing settings, depending on the context it is being called from. Below are few highlights of this keyword:

3 Siblings – With Sharing, Inherited Sharing, Without Sharing

 

  • If the class is the entry point of a transaction, it will run in with sharing mode.
  • If the class is a Visualforce controller, it will in with sharing mode.
  • If the class is being called from some other class which is having without sharing setting, it will run in without sharing mode.

 

https://gist.github.com/8486e9e04ec5c7f78ad921082c790917

2. Now make API Calls to your own org without Remote Site Setting Or Named Credential🤗

Now you can make an API call to your own org without creating remote site setting or named credential. You can use System.Url.getOrgDomainUrl() to access REST or SOAP APIs. This feature is useful:

  • To access API only restricted object.
  • Make API calls using system methods like System.Url.getOrgDomainUrl() and System.UserInfo.getSessionId()

Note: Please use new System.UserInfo.getSessionId() method to get user’s session id.

https://gist.github.com/20d0c407735b1156e5dad62a457dc038

3. New Apex Methods

  1. Schema.DescribeFieldResult.isAiPredictionField() – Returns a Boolean indicating whether the field is enabled to display Einstein prediction data.
  2. Schema.DescribeSObjectResult.getRecordTypeInfosByDeveloperName() – Returns a map that matches developer names to their associated record type.
  3. Schema.RecordTypeInfo.getDeveloperName() – Returns the developer name for this record type.
  4. System.Test.stopTest() – Executes scheduled actions for record-change processes (built in Process Builder), and resumes flows that are waiting on alarms (time-based events).
  5. System.Url.getOrgDomainUrl() – Returns the canonical URL for your Org.
  6. System.UserInfo.getSessionId() –  This method returns the session ID only when the code is run by an active, valid user
  7. runTests() (SOAP API Method) – This method will now include two more parameters in response:
    • flowCoverage – An array of results from test runs that executed flows.
    • flowCoverageWarnings – An array of warnings generated by test runs that executed flows.

#2 Visualforce Features – Not much here, but still few things to notice

1. URL Redirect Parameters Are No Longer Case-Sensitive

The protected URL parameters used in Visualforce pages—retURLstartURLcancelURL, and saveURL—are no longer case-sensitive. If you change the parameter value from retURL to returl, the system now recognizes it as a protected parameter. Protected URL parameters allow redirects from Visualforce pages to salesforce.com or *.force.com domains and prevent malicious redirects to third-party domains.

2. Create and Edit Field Sets in Lightning Experience

Now you can create and edit fieldsets in Lightning Experience.

Winter 19 has a lot for Salesforce developers and makes it even easier to write code and implement features. The source of above post and content is official release notes.

Manish Choudhari

I am a certified Salesforce Application & System Architect and Developer working on Salesforce Technology since 2014. Currently, I have 14 Salesforce certifications along with OCPJP (Oracle Certified Profession JavaSE6 Programmer) working in Salesforce.com Hyderabad as a Technical Engineer. Writing technical blogs, learning new technologies and frameworks and sharing knowledge is my hobby.

Leave a Reply

Close Menu