Sunday, 2 June 2019
Navigate users to record detail after finishing Screen Flow
Using trigger events / context variables with enum System.TriggerOperation
This enum makes life easy for developer from using different context variables like triger.isAfter and trigger.isInsert with a bunch of AND statements and IF statements. The new Trigger context variable Trigger.operationType will returns an enum System.TriggerOperation during trigger context. With this enum we can easily identify the current trigger context and can invoke our logic from handlers. This enum can also be used with in a trigger handler class.
The simple snippet below demonstrates using this enum with a switch statement.
Result in debug logs when updated a record on Account object.
Happy coding, cheers!!!
Resources:
Releases notes Spring'19
TriggerOperation Enum
In summer'18 release Salesforce has first introduced enum System.TriggerOperation which consists specific set of trigger context vari...
Sunday, 25 March 2018
Lightning Component for Sending Email for List View Selected Records and using Email Templates
I assumed sending email for person accounts (person accounts by default not available in salesforce you have to rise a case to enable them) of Opportunities. Please choose different object for sending(from contact List view) since if you don't have person accounts enabled you will get compile errors.
You also need to create a rich text field in any object since we don't have standard richtext tags in lighting at the time of posting this blog post. We need rich text field to mimic the email composer screen and also to render the text review of template selected.
I have used a List view button of type visualforce in opportunities List view and in visualforce page i have placed Lightning Component.
The list view selected records will be sent to Lightning Component.
Get the snippets below to image.
Visualforce Page:
Controller Extension:
EmailComp:
Controller.js:
Helper.js:
EmailComp Apex Class:
I did not mentioned the snippet for the component "c:reUsableMultiSelectLookup" here. Because it is a custom look up component that can be available from many places like salesforce forums and blogs. All you need to do is to tweak the init section of your look up component by passing the selected items to display them automatically.
Hi there, At the time of this blog post, There is no standard Lightning component available for Email composer, So I created a custom compo...
Formula Field to calculate hours from Date Time field in Salesforce
Hey there, This is sample formula field to get difference in hours from date time field to current time. I have considered Event standard...
Sunday, 10 December 2017
Salesforce Notes view VF Component
This is about a SF Notes display in view only. Actually intended for a specific profile to display notes in View only in Detail Page Layout and removing standard related list and added a custom VF page in Detail section . I came across this scenario in one of my project and i hope it would be useful for someone.
Used an OFFSET based pagination since ContentNotes doesn't allow standardsetcontroller pagination. And also to display popup used a rerender based to make component simple as possible.
Page:
VF Component:
Apex Cls:
Hello geeks, This is about a SF Notes display in view only. Actually intended for a specific profile to display notes in View only in Det...
Saturday, 9 December 2017
Salesforce Lightning Compent to Insert Multiple Attachments
This is about a Lighting Component for uploading multiple Attachments for any Object.
It would work for all objects and can also be re usable in SF communities. To get an easy understanding i've used the component in Quick Action / lightning action. Thanks to Manoj for actual idea and support.
The Attachment would be inserted simultaneously when selected a file and also deleteing would deleted from database.
Component:
Controller JS:
Helper JS:
Styles:
Apex cls:
Hello there. This is about a Lighting Component for uploading multiple Attachments for any Object. It would work for all objects and ca...
Sunday, 5 November 2017
Using external Javascript libraries in Lightning / Chart JS in Salesforce Lightning
The afterScriptsLoaded action in the client-side controller is called after the scripts are loaded. Don't use the init event to access scripts loaded by <ltng:require>. These scripts load asynchronously and are most likely not available when the initevent handler is called
Lets have a look at the basic initialization of external chart librarbies in Lightning using Chart JS
1) Import Chart JS min bundle or get the latest from chart js site ans save it into static resource
2) Create a lighting component bundle and app as shown below sample code.
Demo App:
Component:
ControllerJS:
ApexClass:
To reference a JavaScript library that you’ve uploaded as a static resource, use a <ltng:require> tag in your .cmp or .app marku...











