Governor Limits

Using Limit class in Salesforce

We know that salesforce works on the concept of Multi-Tenancy, because of which there are many governor limits that are in place to use the salesforce server resources smoothly. To check the limitations of in apex class as per specific scenario, we can make use of standard limit class.

The Limits methods return the specific limit for the particular governor, such as

  • the number of calls of a method
  • the amount of heap size remaining.
  • Query Limits
  • Queueable Jobs
  • Number of API calls
  • Limits on DML statements
Continue reading “Using Limit class in Salesforce”
Trailhead

Security.stripInaccessible

When working on DML operation in salesforce from Apex class developer might miss the security permissions that are assigned to different users through profiles, permission sets, sharing rules etc. This can lead to an exception. In this blog we will just see the solution for trailhead module for PD-1 certification. I will cover more details about stripInaccessible feature in a separate blog.

Continue reading “Security.stripInaccessible”
Salesforce Lightning

KeyCode of a key pressed in Lightning Web Component

There will be a scenario where you need to identify if Enter is presses or any special character is pressed. Below code will demonstrate how to identify a keypress code. In Lightning Web Component.

For this scenario we need to add a span section with onkeypress event above the input text field. And call a JS method. Something like this.

Continue reading “KeyCode of a key pressed in Lightning Web Component”
Salesforce Lightning

Toast Message in Lightning Web Component

It is always a good practice to display a toast message so that users are aware of what is happening in system. A toast message can be show to user when you want to show a Success message or an Error message or a Warning message. Toast message is simple to write and very effective.

In this blog we will see all 3 ways in which we can display a toast message. A toast can also simply provide information. To display a toast notification in Lightning Experience or Lightning communities, import ShowToastEvent from the lightning/platformShowToastEvent module.

When you dispatch an event to show the toast message you need to know few properties that are used in toast message.

Continue reading “Toast Message in Lightning Web Component”
Salesforce Lightning

Calling Apex Method with Parameters from a Lightning Web Component

There will be ample scenarios where a developer must customize things in salesforce to meet the business requirement. Customization in Lightning Web Component (LWC) can be done in multiple ways based on requirement. One is using lightning-record-edit-form and lightning-record-form. With these developers will have very minimal control over the component. Another way is by calling a server-side method. With this, developers will have good control over the component and can achieve complex business requirement. In this blog we will see how we can call a server Apex Method with parameters from an LWC JavaScript(.JS) file.

There are few things to note when you want to call an apex method.

  1. Importing the Server-side method (apex class).
  2. Calling a Server-side method from JS method.
  3. Fetching the value that is returned.
Continue reading “Calling Apex Method with Parameters from a Lightning Web Component”
Salesforce Admin

Clickable Custom formula field (Relative vs Absolute)

Developers usually get strange requests from client to make some of the text clickable so that if a user clicks on that field in record it should redirect to detailed page of that record. We know that standard Name field already does similar task. However there will be a scenario where client uses Standard name field as auto number field and a custom field to save proper name and requests for a clickable link on the custom field and requests to make it clickable.

There are multiple ways in which we can perform this task. But in this blog we will see 2 ways using formula field.

One simple way that everyone follows is using a relative URL, where you can create a custom formula field and use relative URL with record Id.

Continue reading “Clickable Custom formula field (Relative vs Absolute)”
Salesforce Lightning

Custom Lightning Component in Outlook or Gmail Side Panel

Sales reps depend on 2 important tools one is CRM to store information related to opportunities and leads and second is emails to communicate with contacts. CRM and Email are 2 different applications and sometimes it is annoying to toggle between apps to create records in salesforce when user is busy following up with multiple clients or customers at a time viz emails. It is also important to keep track of all interactions, activities and events into Salesforce.

The “Salesforce Lightning for Outlook” add-in can solve this problem. This plugin will give user a small side window panel, where user can create records in salesforce without having to login to salesforce separately in a browser. This will be like mobile version of salesforce in outlook.

Salesforce Lightning For Outlook Add-On search result.

Once you install the plugin, you need to login to either sandbox instance or Production Instance. You can create records of almost all objects. If you want a specific record type record to be created, you can create Global Actions for the same. This is a standard feature of salesforce.

There will be some scenarios where you may need to customize things as per business scenarios. And to add the custom-built logic, sometimes you need to build a custom solution either in Lightning Aura Component or in Lightning Web Component. But how to add the custom build module in the side panel in your outlook or Gmail plugin, we will see that in this post.

Continue reading “Custom Lightning Component in Outlook or Gmail Side Panel”
Salesforce Lightning

Lightning Web Component using lightning-record-edit-form

<lightning-record-edit-form />

Use the lightning-record-edit-form component to create a form that’s used to add a Salesforce record or update fields in an existing record. If you need a solution with custom screen, you need to use this tag. Whole layout need to be customized. The component displays fields with their labels and the current values, and enables you to edit their values.

lightning-record-edit-form supports the following features.

  • Editing a record’s specified fields, given the record ID.
  • Creating a record using specified fields.
  • Customizing the form layout
  • Custom rendering of record data.

If there is no customization required then you can go ahead with <lightning-record-form /> tag for development.

Continue reading “Lightning Web Component using lightning-record-edit-form”
Salesforce Lightning

Lightning Web Component using lightning-record-form.

<lightning-record-form  />.

To Create, Edit and View a record “Quickly” you can use “<lightning-record-form />”  tag. Salesforce automatically Loads all fields in the object’s compact or full layout, or only the fields you specify. There is no manual custom field tag that user need to add and customize the layout. Salesforce handles everything for you including the lookup fields.

Overall if you are looking for a quick solution to create a record instantly, you can go with <lightning-record-form />.  

Every tag comes with some attributes. For this tag there are few important attributes that are usually used.

  1. object-api-name
  2. fields
  3. record-id
  4. layout-type 
  5. mode
  6. record-type-id

There are few more…

Continue reading “Lightning Web Component using lightning-record-form.”