Launch Lightning Component using formula field and also read query parameter in Salesforce Lightning Component
Before Summer 18, to read parameter in Lightning Component, we had to wrap Lightning Component in Lightning Application. After Summer 18, it has changed for good.
In this blog post we would create a formula field to launch Lightning Component (yes, you read it right). And then we would read URL parameter in Lightning Component using pageReference provided by interface lightning:isUrlAddressable.
Lightning Base components are out of the box component created with Salesforce Lightning Design System CSS. If there are no Lightning Base components, You would need to use aura or HTML components and write custom CSS to make look and feel similar to Lightning Experience. Base component starts with lightning: namespace. There are many new Base components introduced like lightning:datatable , lightning:checkboxGroup , lightning:dualListbox , lightning:progressIndicator , lightning:progressBar, lightning:slider. Recently only I blogged about Read only Chevron Component with mountains of code. Even though we are using this component for last 6 months however If my project could have waited, then all I had to use is 5-6 lines of code using lightning:progressIndicator.
2. Component Library (Beta)
We can already see all standard and custom component information using https://<myDomain>.lightning.force.com/auradocs URL. However, as part of Winter 18 release, Salesforce came up with revamped website just like Lightning Design System to show code snippets on how to use Lightning Components. You can navigate to Component Library using https://<myDomain>.lightning.force.com/componentReference/suite.app URL.
How to use lightningStylesheets attribute to render Visualforce in Lightning Experience Stylesheet
Reason I posted previous blog was to showcase life of Visualforce developer before and after Winter 18. If we want to use same Visualforce in classic and Lightning experience then we had to check theme of logged-in user in Visualforce and render page section accordingly.
In Summer 17, URLFOR method in Visualforce would not work in Lightning Experience if used directly. Even sforce.one API is not fully compatible.
You read it right. Its not Locker Service that may break your code, but Summer 17. If you have legacy Visualforce page, which needs to navigate to Lightning experience and URLFOR is used directly, then chances of getting below error are very high.
List of my favorite features in Salesforce Spring 17
In this post, I would be only talking about Generally available (GA) features, excluding pilots and Beta. Saving those awesome features for suitable time to come. So, here are some of my favorite picks from Spring 17.
Imagine we are doing REST API call from external system by creating Account first and then contact. In between if internet connection is gone or user closes browser and only Account created without contact ? From Spring 17, we can reduce number of REST API calls made by combining them in single request. Advantage of this feature would be easier transaction management and API limit saving. You can have up to 25 subrequests in a single call. Up to 10 of these subrequests can be query operations, including Query, QueryAll, and “Query More” requests to obtain the next batch of query results. Continue reading “Salesforce Spring 17 release – My favorite features”
Summer 16 is already in production and most of you already knows what’s there in pandora box. In this post, I will share my favorite 20 features of Summer 16 release.
1. Clone Sandbox (Pilot) : This feature is not yet generally available however worth mentioning. Till now, we could create Sandbox only from production, however Summer 16 gives us a way to create brand new sandbox from other existing sandbox instead of production.
2. New Trace Flags in Debug Log : Now we can add trace flags on Automated Process, User, Apex Trigger and Apex classes as well. Before this release, we could only add trace flag on user. This enhancement will give developers more control over what to display in debug log and overcome debug log size limit problems.
Summer 16 release of Salesforce brings festival of lights not only in its logo but to Process builder as well
Before going to this feature, lets try to outline problem first. Consider a situation where we need to create a task when lead source is Email and send an email to owner if lead source is Email and company name as ABC.
If we try to solve it using process builder, very soon we will understand that it is not possible in one process builder. Process builder can have only one criteria with true and false condition. In previous process builder, we could either perform action if lead source is Email or lead source is Email and company ABC. There is no way to define new criteria which will run along with previous criteria as shown in below image.
Objects are objects, even if they are standard or custom objects. Salesforce simplified navigation to access Objects, we can access it now from “Object Manager” menu in setup.
2. Lightning App builder to edit record page layout (pilot)
“Lightning App builder” should be enabled first to use this feature. We can use lightning components developed in Org or from AppExchange and change new lightning layout by using intuitive, drag and drop page layout editor.
3. Rollup Summary field limit increased from 10 to 25
4. Restricted Picklist (Pilot)
Using Apex , Dataloader or any other API , it is possible to save any other value than allowed value in picklist field. This future will enforce data integrity and result in error if other than allowed value selected in DML operation.
1. Import Account / Contact from 16 different sources (previously generic csv was only option to import).
2. Salesforce Analytics Query language (SAQL)
We already know about SOQL and SOSL. This is new Query language for Analytics cloud to enable ad hoc analysis of data stored in dataset. This is still in pilot.
3. Enhanced version of “Notes”
In this release, Salesforce has released new version of notes, which has many advantages over old like Create Standalone Notes, Relate same notes to multiple records, include bullet or numbered list, search only on notes, Create tasks from notes, Report on notes.
There may be scenario in Salesforce that you need to send a Visualforce page rendered as PDF as a part of Email Attachment. This will be very easy if you want to perform this using Controller or Extension class, we just have to call getContentAsPDF() method of PageReference class and use returned blob data as a attachment in Email.
Update – 21 Oct 2015 (Winter 16)
After Winter 16 release, this solution will not work as getContent() method is treated as callout and if we try to call it from Async Apex or Rest API in this case, it will not return pdf content.
This solution will only work for you if you have not enabled critical update “PageReference getContent() and getContentAsPDF() Methods Treated as Callouts” in your Salesforce organization.
If we are talking about achieving same in Trigger then it would be problem. Trigger does not support getContent() method of PageReference class. If you are thinking to use getContent() in future call then again we are not lucky, because @future methods does not support it. Also Apex job doesn’t support this method.
Now, I hope you understood that in which situation we are 🙂
So, In this article, I am going to explain how to resolve this issue. Not exactly resolve but workaround for above problem.