Queueable Apex Salesforce

Queueable Apex Salesforce

Queueable Apex Salesforce is more advanced and enhanced version of future methods with some extra features.  It has simplicity of future methods and the power of Batch Apex and mixed them together to form Queueable Apex. It gives you a class structure that the platform serializes for you, a simplified interface without start and finish methods and even allows you to utilize more than just primitive arguments! It is called by a simple System.enqueueJob() method, which returns a job ID that you can monitor.  We need to implement Queueable interface for performing queueable operation.

Queueable Apex Salesforce

Advantage of using queueable Apex

Queueable jobs are similar to future methods in that they’re both queued for execution, It has following benefit compared to future methods:

  • Getting an ID for your job: When we submit our job by invoking the System.enqueueJob method, the method returns the ID of the new job. This ID corresponds to the ID of the AsyncApexJob record. We can use this ID to identify job and monitor its progress, either through the Salesforce user interface in the Apex Jobs page, or programmatically by querying your record from AsyncApexJob.
  • Using non-primitive types: Your queueable class can contain member variables of non-primitive data types, such as sObjects or custom Apex types. Those objects can be accessed when the job executes.
  • Chaining jobs: You can chain one job to another job by starting a second job from a running job. Chaining jobs is useful if you need to do some processing that depends on another process to have run first.

Queueable Versus Future

Because queueable methods are functionally equivalent to future methods, most of the time you’ll probably want to use queueable instead of future methods. However, this doesn’t necessarily mean you should go back and refactor all your future methods right now. If you were exceeding a governor limit in your future method, or if you think a future method requires a higher limit, you can possibly increase the limits for your future method with the Future Methods with Higher Limits pilot.

Another reason to use future methods instead of queueable is when your functionality is sometimes executed synchronously, and sometimes asynchronously. It’s much easier to refactor a method in this manner than converting to a queueable class. This is handy when you discover that part of your existing code needs to be moved to async execution.

Queueable Apex Syntax

We need to implement Apex Class with Queueable Interface which contains only one method execute. We also need to implement DatabaseAllowsCallouts in case if you wanted to process the callouts from the Queueable apex.

public class SomeClassName implements Queueable { 
    public void execute(QueueableContext context) {
        // awesome code here
    }
}

Execute Queueable Apex

Execute the Queueable apex with  System.enqueueJob method which will return the job Id. Once you enqueue a new job, you get a job ID that you can actually monitor from the ApexJobs sections or by using AsyncApexJob object.

ID jobID = System.enqueueJob(new SomeClassName());

Queueable Apex Example

In this example we will append sfdcpoint at the end of account name

public class AccountQueueableExample implements Queueable {
    public List<Account> accList ; 
    public AccountQueueableExample(List<Account> accList){
        this.accList = accList ;  
    }
    public void execute(QueueableContext context) {
        for(Account acc :accList){
            // Update the Account Name 
            acc.Name = acc.Name + 'sfdcpoint';
        }
        update accList;
    }
}

Run the job from the execute anonymous with below code

List<Account> accList = [Select Id , Name from Account ];
ID jobID = System.enqueueJob(new AccountQueueableExample(accList));
System.debug('jobID'+jobID);

Test class for Queueable Apex

@isTest
public class AccountQueueableExampleTest {
    @testSetup 
    static void setup() {
        List<Account> accounts = new List<Account>();
        // add 100 accounts
        for (Integer i = 0; i < 100; i++) {
            accounts.add(new Account(
                name='Test Account'+i
            ));
        }
        insert accounts;
    }
    
    static testmethod void testQueueable() {
        // query for test data to pass to queueable class
        List<Account> accounts = [select id, name from account where name like 'Test Account%'];
        // Create our Queueable instance
        AccountQueueableExample accQObj = new AccountQueueableExample(accounts);
        // startTest/stopTest block to force async processes to run
        Test.startTest();        
        System.enqueueJob(accQObj);
        Test.stopTest();        
        // Validate the job ran
        System.assertEquals(100, [select count() from account where Name like = '%sfdcpoint%']);
    }
    
}

Queueable Job chaining

One of the best features of Queueable Apex is job chaining. If you ever need to run jobs sequentially, Queueable Apex could make your life much easier. To chain a job to another job, submit the second job from the execute() method of your queueable class. You can add only one job from an executing job, which means that only one child job can exist for each parent job. For example, if you have a second class called SecondJob that implements the Queueable interface, you can add this class to the queue in the execute() method as follows:

 
public class FirstJob implements Queueable { 
    public void execute(QueueableContext context) { 
        // Awesome processing logic here    
        // Chain this job to next job by submitting the next job
        System.enqueueJob(new SecondJob());
    }
}

Queueable Apex limits

Queueable Apex is a great new tool but there are a few things to watch out for:

  • The execution of a queued job counts once against the shared limit for asynchronous Apex method executions.
  • You can add up to 50 jobs to the queue with System.enqueueJob in a single transaction.
    When chaining jobs, you can add only one job from an executing job with System.enqueueJob, which means that only one child job can exist for each parent queueable job. Starting multiple child jobs from the same queueable job is a no-no.
  • No limit is enforced on the depth of chained jobs, which means that you can chain one job to another job and repeat this process with each new child job to link it to a new child job. However, for Developer Edition and Trial orgs, the maximum stack depth for chained jobs is 5, which means that you can chain jobs four times and the maximum number of jobs in the chain is 5, including the initial parent queueable job.

 

For more details about Queueable Apex please refer to Control Processes with Queueable Apex  trailhead

Permanent link to this article: https://www.sfdcpoint.com/salesforce/queueable-apex-salesforce/

What is SFDC? SFDC Full Form?

What is SFDC

What is SFDC?

The full form of SFDC is Salesforce Dot Com, or you can say Salesforce.com. Salesforce.com, Inc. is an American cloud-based software company established by Marc Benioff headquartered in San Francisco, California. Its major revenue comes from its CRM (Customer relationship Management) )service. Salesforce also sells a complementary suite of enterprise applications focused on customer service, marketing automation, analytics, and application development.

What is SFDC

What is Salesforce?

Salesforce is the world’s #1 customer relationship management (CRM) platform. Salesforce provides cloud-based, CRM applications for sales, service, marketing, and more.

Salesforce has essentially changed how enterprise software is delivered and used. Its software is cloud-based and hence doesn’t need IT experts to set up anything. Salesforce has defined the ideal way as how to connect with customers. Building meaningful and lasting bond with the customers, identifying their needs, address problems faster and deploy apps that are customer focused is all possible through Salesforce.

Salesforce Technologies is one of the leading and very hot Technology in IT industry. Through Salesforce.com Technology thousands of Job opportunity are created for Salesforce developers and Salesforce Administration Job Seekers. As per Forbes magazine, nearly 55% of enterprises predict cloud computing will enable new business model in three years. So Salesforce is one of the Cloud Computing Technology which have bright future in the upcoming years. Salesforce provides different enterprise cloud computing applications to all size industries and businesses.

Salesforce applications are provided on subscription basis primarily through direct sales effort and indirectly through partners.

Salesforce Cloud Products:

Salesforce Sales Cloud

Salesforce Sales Cloud is a customer relationship management (CRM) platform designed to support sales, marketing and customer support in both business-to-business (B2B) and business-to-customer (B2C) contexts. Sales Cloud is the most popular salesforce cloud product.

Sales Cloud puts all your customer information in one place, gives you insight into your customers, and even gives you intelligent alerts about the best leads. You can see real-time reports of how the business is doing, and the intuitive workspace helps you be productive.

Sales Cloud is a fully customizable product that brings all the customer information together in an integrated platform that incorporates marketing, lead generation, sales, customer service and business analytics and provides access to thousands of applications through the AppExchange. The platform is provided as Software as a Service (SaaS) for browser-based access; a mobile app is also available. A real-time social feed for collaboration allows users to share information or ask questions of the user community.

Salesforce Marketing Cloud

Salesforce Marketing Cloud is a provider of digital marketing automation and analytics software and services. It was founded in 2000 under the name ExactTarget. ExactTarget was renamed to Salesforce Marketing Cloud in 2014 after the acquisition by Salesforce.

Salesforce Marketing Cloud develops marketing automation and analytics software for email, mobile, social and online marketing. It also offers consulting and implementation services.[27] The software is sold primarily on a multi-year subscription basis. The price of the subscription is based on what features are enabled, number of users and level of customer service.

Salesforce Service Cloud

Service Cloud is a customer service and support application. It helps keep your customers happy and your support team sane, whether your customers reach out to you by email, phone, social media, online communities, or real-time Web chat. These different ways of reaching out are called channels, and they help you help your customers through their preferred communication tool. Giving your customers a choice in how they communicate with your company is the first step towards delivering extraordinary service.

Salesforce Einstein

Salesforce Einstein is a set of best-in-class platform services that bring advanced AI capabilities into the core of the Customer Success Platform, making Salesforce the world’s smartest CRM.

Powered by advanced machine learning, deep learning, predictive analytics, natural language processing and smart data discovery, Einstein’s models will be automatically customized for every single customer, and it will learn, self-tune, and get smarter with every interaction and additional piece of data. Most importantly, Einstein’s intelligence will be embedded within the context of business, automatically discovering relevant insights, predicting future behavior, proactively recommending best next actions and even automating tasks. With Einstein, the world’s #1 CRM is now the world’s smartest CRM and we’re bringing intelligence to all of our clouds. But don’t take my word for it. See below to hear from our Cloud GMs about what Einstein means for all our clouds.

Community Cloud

Community cloud you create an online community  to connect with the important folks in your life (you know, customers, partners, and employees) in a new and different way.

Here are some common use cases of community

Customer Service and Account Portals
Empower your customers to find solutions to their customer-service issues on their own with access to your knowledge base, your service agents, and peer-to-peer support. In addition, give customers access to their data in a member portal.
Partner Relationship Management and Channel Sales
Increase your (and your partners’) revenue stream by collaborating on opportunities and deals. Onboard partners quickly by sharing content and training materials.
Employee Relationships
Retain happier employees by providing a space for them to easily complete their onboarding, learn about benefits, and resolve HR issues.

Commerce Cloud

Commerce Cloud is a cloud-based online business stage that can oversee items giving a wide scope of offices. It conveys a complete computerized involvement to its clients. It upgrades clients’ shopping background. It associates the clients or customers with the correct item at the opportune time. It is utilized for associating merchandisers with the correct data they need so as to settle on the correct business choices with Artificial Intelligence.

 

Technologies in Salesforce

Apex

Apex is a programming language that empowers designers to execute stream and trade control enunciations on the Force.com organize. As a tech lingo, Apex is composed, easy to use, data connected with, careful, encouraged, multitenant careful, normally upgradeable, easy to test, and shaped. For more details about apex please refer What is Apex

Visualforce

Visualforce is a structure that enables the creation of dynamic, reusable interfaces that can be encouraged locally on the Force.com. It might be used to make entire custom pages inside a Salesforce affiliation, or planners can interface their own one of a kind method of reasoning with a controller class written in Apex. Creators can use Visualforce pages to override standard gets, revoke tab audit pages, describe custom tabs, embed parts in detail page designs, make dashboard portions, re-try sidebars in the Salesforce support, and incorporate menu things.

Salesforce Lightning

Salesforce Lightning is the collection of tools and technologies behind a significant upgrade to the Salesforce platform. Lightning includes:

  • Experience: A set of modern user interfaces optimized for speed. This includes the Lightning Experience, Salesforce1 Mobile app and template-based communities.
  • Lightning Component Framework: A JavaScript framework and set of standard components that allow you to build reusable components to customize the Lightning Experience, Salesforce1 Mobile app and template-based communities and build your own standalone apps.
  • Visual Building Tools: Drag-and-drop technologies for fast and easy app building & customizations. Use the Lightning App Builder to customize the Lightning Experience and Salesforce1 Mobile app. Use the Community Builder to customize template-based communities.
  • Lightning Exchange: A section of the AppExchange where you can find 70+ partner components to jumpstart your development.
  • Lightning Design System: Style guides and modern enterprise UX best practices to build pixel perfect apps that match the look and feel of the Lightning Experience and Salesforce1 Mobile app.

For more details about lightning please refer Salesforce Lightning

Permanent link to this article: https://www.sfdcpoint.com/salesforce/what-is-sfdc/

Lightning Web Component lightning-datatable

Lightning Web Component lightning-datatable

Lightning Web Component lightning-datatable in lwc

lightning-datatable component displays tabular data for list of records. lightning-datatable component supports inline editing, which enables you to update a field value without navigating to the record. We cab display each column based on the data type.

Lightning Web Component Datatable example

Lets create lightning web component where we will display all account records using datatable.

First we need to create apex class for it.

AccountHelper class
public with sharing class AccountHelper {
    @AuraEnabled(cacheable=true)
    public static List<Account> getAccountList() {
        return [SELECT Id, Name, Type, Rating,
                Phone, Website, AnnualRevenue
            FROM Account];
    }
}

The @AuraEnabled(cacheable=true) annotation exposes the method to Lightning components and caches the list of accounts on the client.

lightningDatatableLWCExample.js

import { LightningElement ,api, wire, track} from 'lwc';
import getAccountList from '@salesforce/apex/AccountHelper.getAccountList';
export default class LightningDatatableLWCExample extends LightningElement {
    @track columns = [{
            label: 'Account name',
            fieldName: 'Name',
            type: 'text',
            sortable: true
        },
        {
            label: 'Type',
            fieldName: 'Type',
            type: 'text',
            sortable: true
        },
        {
            label: 'Annual Revenue',
            fieldName: 'AnnualRevenue',
            type: 'Currency',
            sortable: true
        },
        {
            label: 'Phone',
            fieldName: 'Phone',
            type: 'phone',
            sortable: true
        },
        {
            label: 'Website',
            fieldName: 'Website',
            type: 'url',
            sortable: true
        },
        {
            label: 'Rating',
            fieldName: 'Rating',
            type: 'test',
            sortable: true
        }
    ];

    @track error;
    @track accList ;
    @wire(getAccountList)
    wiredAccounts({
        error,
        data
    }) {
        if (data) {
            this.accList = data;
        } else if (error) {
            this.error = error;
        }
    }
}

We are creating columns and accList prroperty which we will use in html file datatable.

lightningDatatableLWCExample.html

<template>
    <h2> Account Datatable</h2>
    <template if:true={accList}>
        <lightning-datatable data={accList} columns={columns} key-field="Id">
        </lightning-datatable>
    </template>
    <template if:true={error}>
        {error}
    </template>
</template>

lightningDatatableLWCExample.js-meta.xml

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>48.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__HomePage</target>
    </targets>
</LightningComponentBundle>

In above file, we are exposing lwc component for home page.

Now we can add this lwc component on home page

  • Go to Home page
  • Click Setup (Gear Icon) and select Edit Page.
  • Under Custom Components, find your lightningDatatableLWCExample component and drag it on left hand side.
  • Click Save and activate.

We will have following output:

Lightning Web Component lightning datatable

For more detail please refer to official link.

Happy Coding 🙂

Permanent link to this article: https://www.sfdcpoint.com/salesforce/lightning-web-component-lightning-datatable/

Call Apex Methods In Lightning web components

Call Apex Methods In Lightning web components

Lightning web components can import methods from Apex classes into the JavaScript classes. Once after importing the apex class method you can able call the apex methods as functions into the component by calling either via the wire service or imperatively. The Apex Method should be marked with @AuraEnabled. Before you use an Apex method, make sure that there isn’t an easier way to get the data. See whether a base Lightning component, like lightning-record-form, lightning-record-view-form, or lightning-record-edit-form works for your use case. If they don’t give you enough flexibility, use a wire adapter like getListUi or getRecordUi. And if you can’t use a wire adapter, write an Apex method.

In this example, we will query all account records and will display it.

Import Syntax

We need to import the @salesforce/apex scoped module into JavaScript controller class.

import apexMethodName from '@salesforce/apex/Namespace.Classname.apexMethodReference';

Here is list of important point of importing apex method:

  • apexMethodName : An imported symbol that identifies the Apex method.
  • apexMethodReference : The name of the Apex method to import.
  • Classname : The name of the Apex class.
  • Namespace—The namespace of the Salesforce organization. Specify a namespace unless the organization uses the default namespace (c), in which case don’t specify it.

 

Call Apex Methods In Lightning web components Example

Apex class AccountHelper

 
public with sharing class AccountHelper {
    @AuraEnabled(cacheable=true)
    public static List<Account> getAccountList() {
        return [SELECT Id, Name, Type, Rating, Phone 
            FROM Account];
    }
}

We can call the apex class in  Lightning web component using these different ways:

  • Wire a property
  • Wire a function
  • Call a method imperatively

 

Wire a property in lightning Web Component

We can invoke apex method from a component via the wire service. We can @wire a property or a function. Here is the syntax

 
import apexMethod from '@salesforce/apex/Namespace.Classname.apexMethod';
@wire(apexMethod, { apexMethodParams })
propertyOrFunction;

Lets see example of Wire an Apex Method to a Property

accountListLWC.js

 
import { LightningElement, wire } from 'lwc';
import getAccountList from '@salesforce/apex/AccountHelper.getAccountList';
 
export default class AccountListLWC extends LightningElement {
    @wire(getAccountList) accounts;
}

accountListLWC.html

 
<template>
    <lightning-card title="Account List From Apex" icon-name="custom:custom63">
            <div class="slds-m-around_medium">
                <template if:true={accounts.data}>
                    <template for:each={accounts.data} for:item="acc">
                        <p key={acc.Id}>{acc.Name}</p>
                    </template>
                </template>
                <template if:true={accounts.error}>
                    {accounts.error}
                </template>
            </div>
        </lightning-card>
</template>

accountListLWC.js-meta.xml

 
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>48.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__HomePage</target>
    </targets>
</LightningComponentBundle>

Now we can add this lwc component on account detail page.

  • Go to Home page
  • Click Setup (Gear Icon) and select Edit Page.
  • Under Custom Components, find your accountListLWC component and drag it on right hand side top.
  • Click Save and activate.

We will have following output.

 

Wire a function in lightning Web Component

We can use same example of showing account list

accountListLWC.js

import { LightningElement, wire,track } from 'lwc';
import getAccountList from '@salesforce/apex/AccountHelper.getAccountList';
 
export default class AccountListLWC extends LightningElement {
    @track accounts;
    @track error;
    @wire(getAccountList)
    wiredAccounts({ error, data }) {
        if (data) {
            this.accounts = data;
        } else if (error) {
            console.log(error);
            this.error = error;
        }
    }
}

accountListLWC.html

 
<template>
    <lightning-card title="Account List using Apex Wire To Function" icon-name="custom:custom63">
        <div class="slds-m-around_medium">
            <template if:true={accounts}>
                <template for:each={accounts} for:item="acc">
                    <p key={acc.Id}>{acc.Name}</p>
                </template>
            </template>
            <template if:true={error}>
                {error}
            </template>
        </div>
    </lightning-card>
</template>

Call a method imperatively

accountListLWC.js

import { LightningElement, track } from 'lwc';
import getAccountList from '@salesforce/apex/AccountHelper.getAccountList';
export default class AccountListLWC extends LightningElement {
    @track accounts;
    @track error;
    handleLoad() {
        getAccountList()
            .then(result => {
                this.accounts = result;
            })
            .catch(error => {
                this.error = error;
            });
    }
}

accountListLWC.html

<template>
    <lightning-card title="Account List using ApexImperativeMethod" icon-name="custom:custom63">
        <div class="slds-m-around_medium">
            <p class="slds-m-bottom_small">
                <lightning-button label="Load Accounts" onclick={handleLoad}></lightning-button>
            </p>
            <template if:true={accounts}>
                <template for:each={accounts} for:item="acc">
                    <p key={acc.Id}>{acc.Name}</p>
                </template>
            </template>
            <template if:true={error}>
                {error}
            </template>
        </div>
    </lightning-card>
</template>

Following will be output when you click on Load Account button

Call Apex Methods In LWC Imperative Method

For more detail please refer to official link.

Happy Coding 🙂

Permanent link to this article: https://www.sfdcpoint.com/salesforce/call-apex-methods-in-lightning-web-components/

lightning-record-view-form

lightning-record-view-form

A lightning-record-view-form component is a wrapper component that accepts a record ID and is used to display one or more fields and labels associated with that record using lightning-output-field. lightning-record-view-form requires a record ID to display the fields on the record. It doesn’t require additional Apex controllers or Lightning Data Service to display record data. This component also takes care of field-level security and sharing for you. Users will see data only if they have access to view specific field and record.

Lets create simple lightning web component to get account detail.

lightning-record-view-form example in lightning web component

Create recordIdExampleLWC lightning web component from Visual studio code. Use Control shift P and type SFDX: Create Lightning Web Component.

recordIdExampleLWC.html

In html file, we are using lightning-record-view-form to show account detail using recorid. We can also use recordid to query Account record or some other details related to account.

 
<template>
    <div class="acc-container">
        <lightning-record-view-form record-id={recordId} object-api-name="Account">
            <div class="slds-grid">
                <div class="slds-col slds-size_1-of-2">
                    <lightning-output-field field-name="Name"></lightning-output-field>
                    <lightning-output-field field-name="Website"></lightning-output-field>
                </div>
                <div class="slds-col slds-size_1-of-2">
                    <lightning-output-field field-name="Industry"></lightning-output-field>
                    <lightning-output-field field-name="AnnualRevenue"></lightning-output-field>
                </div>
            </div>
        </lightning-record-view-form>
    </div>
</template>

recordIdExampleLWC.js

import { LightningElement,api } from 'lwc';

export default class RecordIdExampleLWC extends LightningElement {
    @api recordId;
}

recordIdExampleLWC.css

Lets apply some styles to our component

 
.acc-container {
    background: white !important;
    border: 1px solid black !important;
}

recordIdExampleLWC.js-meta.xml

 
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>48.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
    </targets>
</LightningComponentBundle>

No we can add this lwc component on account detail page.

  • Go to Account tab.
  • Open any record.
  • Click Setup (Gear Icon) and select Edit Page.
  • Under Custom Components, find your recordIdExampleLWC component and drag it on right hand side top.
  • Click Save and activate.

We will have following output.

Get Record Id in Lightning Web Component Account Record

 

Supported Objects

This component doesn’t support all Salesforce standard objects. For example, the Event and Task objects are not supported. This limitation also applies to a record that references a field that belongs to an unsupported object.

External objects and person accounts are not supported.

For more details please refer to official link.

Happy Coding 🙂

Permanent link to this article: https://www.sfdcpoint.com/salesforce/lightning-record-view-form/

Get Record Id in Lightning Web Component

Get Record Id in Lightning Web Component

Get Record Id in Lightning Web Component

Getting current record id in lightning web component(lwc) is very easy.

If a component with a recordId property is used on a Lightning record page, the page sets the property to the ID of the current record. In the component’s JavaScript class, use the @api decorator to create a public recordId property. Here is example of javascript class.

import { LightningElement, api } from 'lwc';
export default class LWCExample extends LightningElement {
    @api recordId;
}

To get current record id in lightning component(aura component), we had to implement force:hasRecordId to get record id in lightning aura component. But in lightning we component its very simple, we only need to use recordId property with @api decorator.

Lets create simple lightning web component to get account detail.

Create recordIdExampleLWC lightning web component from Visual studio code. Use Control shift P and type SFDX: Create Lightning Web Component.

recordIdExampleLWC.html

In html file, we are using lightning-record-view-form to show account detail using recorid. We can also use recordid to query Account record or some other details related to account.

 
<template>
    <div class="acc-container">
        <lightning-record-view-form record-id={recordId} object-api-name="Account">
            <div class="slds-grid">
                <div class="slds-col slds-size_1-of-2">
                    <lightning-output-field field-name="Name"></lightning-output-field>
                    <lightning-output-field field-name="Website"></lightning-output-field>
                </div>
                <div class="slds-col slds-size_1-of-2">
                    <lightning-output-field field-name="Industry"></lightning-output-field>
                    <lightning-output-field field-name="AnnualRevenue"></lightning-output-field>
                </div>
            </div>
        </lightning-record-view-form>
    </div>
</template>

recordIdExampleLWC.js

import { LightningElement,api } from 'lwc';

export default class RecordIdExampleLWC extends LightningElement {
    @api recordId;
}

recordIdExampleLWC.css

Lets apply some styles to our component

 
.acc-container {
    background: white !important;
    border: 1px solid black !important;
}

recordIdExampleLWC.js-meta.xml

 
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>48.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
    </targets>
</LightningComponentBundle>

No we can add this lwc component on account detail page.

  • Go to Account tab.
  • Open any record.
  • Click Setup (Gear Icon) and select Edit Page.
  • Under Custom Components, find your recordIdExampleLWC component and drag it on right hand side top.
  • Click Save and activate.

We will have following output.

Get Record Id in Lightning Web Component Account Record

 

For more details please refer to official link.

Happy Coding 🙂

Permanent link to this article: https://www.sfdcpoint.com/salesforce/get-record-id-in-lightning-web-component/

Data Skew Salesforce

Data Skew Salesforce

What is data skew in Salesforce?

Data skew in Salesforce happens when large number of child records (more then 10k) are linked to one parent records.

Data Skew Salesforce

Type of Data skew

There are 3 types of data skew in salesforce:

  • Account data skew
  • Ownership skew
  • Lookup Skew

Account data skew:

Certain Salesforce objects, like accounts and opportunities, have special data relationships that maintain parent and child record access under private sharing models. Too many child records associated with the same parent object in one of these relationships causes account data skew. Say you have a bunch of unassigned contacts and park them under one account named “Unassigned.” This can create issues with record locking and sharing performance.

Certain Salesforce objects, such as accounts and opportunities, have special data relationships that maintain parent and child record access under private sharing models. If too many child records are associated with same parent object in one of these relationships, this imbalance causes something called “account data skew,” which in turn causes performance problems.

If you are unfamiliar with account data skew, you can read more about it here.

Ownership Skew:

Similarly, when a large number of records with the same object type are owned by a single user, this imbalance causes something called “ownership skew.” Ownership skew also causes performance problems, which can surface when you’re managing your role hierarchy and sharing rules.

If you are unfamiliar with ownership skew, you can read more about it here.

Lookup Skew:

Lookup skew happens when a very large number of records are associated to a single record in the lookup object.  Because you can place lookup fields on any object in Salesforce, lookup skew can create problems for any object within your organization.

For more details about data skew refer to official salesforce link.

Permanent link to this article: https://www.sfdcpoint.com/salesforce/data-skew-salesforce/

Record Types in Salesforce

Record Types in Salesforce

Record Types in Salesforce

Record types in Salesforce allow you to have different business processes, picklist values, and page layouts to different users based on profile. You might create record types to differentiate your regular sales deals from your professional services engagements, offering different picklist values for each.

Record Types in Salesforce

Record types in Salesforce helps you to configure different business processes, assign page layouts, and picklist values. Salesforce Record types can be linked to user profiles. There can be different page layouts and picklist values based on record types.

Here is list of some important use case of using record types in salesforce:

  • Displaying different page layouts for one object based on business requirements.
  • Showing different picklist values based on the requirements.
  • Restrict field access on layouts based on record types and page layouts.
  • Restrict creation of certain type of record using profile and record type assignment.

 

Business Process

What is a Business Process?

Business Process allows you to track separate sales, support, and lead lifecycles across different divisions, groups, or markets
Available Business Processes:

  • Sales Processes – Create different sales processes that include some or all of the picklist values available for the Opportunity Stage field
  • Support Processes – Create different support processes that include some or all of the picklist values available for the Case Status field
  •  Lead Processes – Create different lead processes that include some or all of the picklist values available for the Lead Status field
  • Solution Processes – Create different solution processes that include some or all of the picklist values available for the Solution Status field

 

Create Record Types

You can create a new record type for any object using object Manager. For example, for creating account record type is lightning

  • From Setup, click Object Manager and select Account.
  • Select Record Types, click New, and fill in the details.

Create Salesforce Record Types

 

For more details refer to Create Record Types Trailhead

Page Layout in Salesforce

Page layouts control the layout and organization of buttons, fields,  Visualforce, custom links, and related lists on object record pages. They also help determine which fields are visible, read only, and required. Use page layouts to customize the content of record pages for your users.

Creating page Layouts

You can create a new page layout for any object using object Manager. For example, for creating account page layout using lightning

  • From Setup, click Object Manager and select Account.
  • Click on Page Layouts, click New,
  • Drag and drop components(fields, buttons) to the layout and save page layout.

Page Layout assignment based on record types and profiles

  • From Setup, click Object Manager and select Account.
  • Click on Page Layout
  • Click on Page Layout Assignment
  • Click on Edit Assignment

Edit Page Layout Assignment

 

 

Permanent link to this article: https://www.sfdcpoint.com/salesforce/record-types-in-salesforce/

Salesforce Certification – Guide to pass all salesforce Certifications

Salesforce Certification

Salesforce Certification – Guide to pass all salesforce Certifications

Salesforce is one of the fastest-growing, most in-demand skillsets today. From software developers, to solutions architects, to project managers and marketing and sales professionals, Salesforce skills pay off for a variety of roles.

Salesforce Certification

Salesforce Certification Overview

Salesforce Certification is the ultimate benchmark that recognizes the skills, expertise, and real-world know-how of today’s cloud specialists. Are you an Administrator who keeps Salesforce running smoothly, or Developer who builds new apps to customize and extend capabilities? Perhaps you’re an Implementation Expert or Marketing Specialist responsible for ensuring the right solutions are deployed for maximum effectiveness. Or are you an Architect who masterminds high-performance technical frameworks?

 

Salesforce Certification types

Here is list of all Salesforce Certification types:

Administrators:

  • Salesforce Certified Administrator
  • Salesforce Certified Advanced Administrator

 

App Builders

  • Salesforce Certified Platform App Builder

 

Developers

  • Commerce Cloud Digital Developer
  • Platform Developer I
  • Platform Developer II

 

Consultants

  • Salesforce Certified Sales Cloud Consultant
  • Salesforce Certified Service Cloud Consultant
  • Salesforce Certified Pardot Consultant
  • Salesforce Certified Einstein Analytics and Discovery Consultant
  • Salesforce Certified Community Cloud Consultant
  • Salesforce Certified Field Service Lightning Consultant
  • Salesforce Certified Nonprofit Cloud Consultant
  • Salesforce Certified Education Cloud Consultant
  • Salesforce Certified Marketing Cloud Consultant

 

Architects

  • Salesforce Certified Data Architecture and Management Designer
  • Salesforce Certified B2C Commerce Architect
  • Salesforce Certified Integration Architecture Designer
  • Salesforce Certified Development Lifecycle and Deployment Designer
  • Salesforce Certified Sharing and Visibility Designer
  • Salesforce Certified Identity and Access Management Designer
  • Salesforce Certified Heroku Architecture Designer
  • Salesforce Certified Technical Architect

Salesforce Architect Journey

 

Specialist

  • Salesforce Certified CPQ Specialist
  • Salesforce Certified Pardot Specialist
  • Salesforce Certified Marketing Cloud Email Specialist
  • Salesforce Certified Marketing Cloud Social Specialist

 

Salesforce certification guide- Passing all salesforce Certification

Salesforce Admin Certification(ADM 201)

Salesforce Certified Administrator candidates should have general knowledge of the features available to end users and the configuration options available to a Salesforce Administrator. Candidates should be able to maintain a Salesforce organization, respond to common business requirements, and perform administrative functions using current Salesforce features.

Read on for details about the Salesforce Administrator exam.

  • Content: 60 multiple-choice/multiple-select questions and 5 non-scored questions
  • Time allotted to complete the exam: 105 minutes
  • Passing score: 65%
  • Registration fee: USD 200 plus applicable taxes as required per local law
  • Retake fee: USD 100 plus applicable taxes as required per local law

How to pass Salesforce Admin Certification

Here is list of important links for passing Salesforce admin certification

 

Salesforce Platform App Builder

Salesforce Platform App Builder credential is designed for individuals who would like to demonstrate their skills and knowledge in designing, building, and deploying custom applications using the declarative customization capabilities of the Lightning Platform. The candidate can create, manage, and update data models, application security, business logic, and process automation.

Read on for details about the Salesforce Platform App Builder exam.

  • Content: 60 multiple-choice/multiple-select questions and 5 non-scored questions
  • Time allotted to complete the exam: 105 minutes
  • Passing score: 63%
  • Registration fee: USD 200 plus applicable taxes as required per local law
  • Retake fee: USD 100 plus applicable taxes as required per local law

How to pass Salesforce Platform App Builder Certification

Here is list of important links for passing Salesforce Platform App Builder certification

Salesforce Sales Cloud Consultant Certification

Salesforce Sales Cloud Consultant program is designed for consultants who have experience implementing Salesforce Sales Cloud solutions in a customer-facing role. The audience has proven experience with the administration and configuration of a Salesforce application, as demonstrated through successful completion of the Salesforce Administrator exam. The Salesforce Sales Cloud Consultant is able to successfully design and implement maintainable and scalable Sales Cloud solutions that meet customer business requirements and contribute to long-term customer success.

Read on for details about the Salesforce Sales Cloud Consultant exam.

  • Content: 60 multiple-choice/multiple-select questions and 5 non-scored questions
  • Time allotted to complete the exam: 105 minutes
  • Passing score: 62%
  • Registration fee: USD 200 plus applicable taxes as required per local law
  • Retake fee: USD 100 plus applicable taxes as required per local law
  • Prerequisite: Salesforce Administrator credential

How to pass Salesforce Sales Cloud Consultant Certification

Here is list of important links for passing Salesforce Sales Cloud Consultant certification

Salesforce Service Cloud Consultant Certification

Salesforce Certified Service Cloud Consultant program is designed for consultants who have experience implementing Salesforce Service Cloud solutions in a customer-facing role. The intended audience has proven experience with the administration and configuration of a Salesforce application, as demonstrated through successful completion of the Salesforce Certified Administrator exam. The Salesforce Certified Service Cloud Consultant is able to successfully design and implement Service Cloud solutions that meet customer business requirements, are maintainable and scalable, and contribute to long-term customer success.

Read on for details about the Salesforce Service Cloud Consultant exam.

  • Content: 60 multiple-choice/multiple-select questions and 5 non-scored questions
  • Time allotted to complete the exam: 105 minutes
  • Passing score: 67%
  • Registration fee: USD 200 plus applicable taxes as required per local law
  • Retake fee: USD 100 plus applicable taxes as required per local law
  • Prerequisite: Salesforce Administrator credential

How to pass Salesforce Service Cloud Consultant Certification

Here is list of important links for passing Salesforce Service Cloud Consultant certification

 

Salesforce Community Cloud Consultant Certification

Salesforce Community Cloud Consultant program is designed for consultants who have experience implementing and consulting on the Salesforce Communities applications in a customer-facing role. The Salesforce Community Cloud Consultant exam is for individuals who want to demonstrate their skills and knowledge in designing, configuring, building, and implementing Salesforce Communities applications, using the declarative customization capabilities of the Communities platform.

Read on for details about the Salesforce Community Cloud Consultant exam.

  • Content: 60 multiple-choice/multiple-select questions
  • Time allotted to complete the exam: 90 minutes
  • Passing score: 62%
  • Registration fee: USD 200 plus applicable taxes as required per local law
  • Retake fee: USD 100 plus applicable taxes as required per local law
  • Prerequisite: Salesforce Administrator credential

How to pass Salesforce Community Cloud Consultant Certification

Here is list of important links for passing Salesforce Community Cloud Consultant certification

Salesforce Data Architecture and Management Designer Certification

Salesforce Certified Data Architecture and Management Designer assesses the architecture environment and requirements and designs sound, scalable, and performant solutions on the Customer 360 Platform as it pertains to enterprise data management. The candidate is knowledgeable about information architecture frameworks covering major building blocks, such as data sourcing, integration/movement, persistence, master data management, metadata management and semantic reconciliation, data governance, security, and delivery.

Read on for details about the Salesforce Data Architecture and Management Designer exam.

  • Content: 60 multiple-choice/multiple-select questions
  • Time allotted to complete the exam: 105 minutes
  • Passing score: 58%
  • Registration fee: USD 400 plus applicable taxes as required per local law
  • Retake fee: USD 200 plus applicable taxes as required per local law
  • Prerequisite: None

How to pass Salesforce Data Architecture and Management Designer Certification

Here is list of important links for passing Salesforce Data Architecture and Management Designer certification

Salesforce Sharing and Visibility Designer Certification

Salesforce Certified Sharing and Visibility Specialist is designed for architects, analysts, and administrators who want to demonstrate their knowledge, skills, and capabilities to design secure, scalable security models on the Force.com platform. A Salesforce Certified Sharing and Visibility Specialist should be fluent in communicating technical solutions effectively to technical stakeholders and providing a project delivery framework that ensures quality and success.

Read on for details about the Salesforce Sharing and Visibility Designer exam.

  • Content: 60 multiple-choice/multiple-select questions
  • Time allotted to complete the exam: 105 minutes
  • Passing score: 67%
  • Registration fee: USD 400 plus applicable taxes as required per local law
  • Retake fee: USD 200 plus applicable taxes as required per local law
  • Prerequisite: None

How to pass Salesforce Sharing and Visibility Designer Certification

Here is list of important links for passing Salesforce Sharing and Visibility Designer certification

Salesforce Certification Cost

Salesforce Certification Cost ranges from $200 to $6,000. Most of Salesforce Certification  cost is $200 or $400. Only Salesforce Certified Technical Architect cost $6,000 .  A retake exam for those who fail is offered at half-price. There is one free certification — Salesforce Accredited Sales Professional. That free course is designed for “pre-approved” Salesforce partner sales, pre-sales and business development professionals who are “engaged in marketing and selling Salesforce solutions.”

Maintaining Your Salesforce Credential

Salesforce releases new system feature updates three times a year (winter, spring, and summer). Each update requires all professionals to maintain their certifications with Trailhead maintenance modules aligned with the Salesforce product release cycles. Depending on your Salesforce credential, the number of certification maintenance modules published per year may vary. View the charts below to see your scheduled maintenance cycle.

Refer to the certification maintenance schedule for details regarding due dates. When the release modules are published, you will receive an email with all the necessary details to complete your maintenance. However, you should not rely on these email notifications; it is your responsibility to complete your release modules by the published deadline.

How to register for Salesforce Certification?

Registering for a Salesforce certification exam, and checking exam availability, is easy to do. Just follow the steps below.

  1. Log in to Webassessor at www.webassessor.com/salesforce. If you do not already have a test taker profile in Webassessor, you will need to create one.
  2. Click Register for an Exam.
  3. Locate the exam you wish to schedule and expand the section to view the delivery options. You can choose to register for the exam as onsite proctored or online proctored. Click the Register button for the delivery method you prefer.
  4. If you selected the onsite proctored exam:
    • Select a testing center.
    • Select the date and time you would like to take the exam; read the Reschedule and Cancellation Policy, select the acknowledgment check box.
  5. If you selected the online proctored exam:
    • Select the date and time you would like to take the exam; read the Reschedule and Cancellation Policy, select the acknowledgment check box.
    • All online proctored exams are automatically adjusted to the time zone of the location you inputted in your Webassessor profile details.
  6. Click Select.
  7. Review the exam and scheduling details for accuracy, click Checkout.
  8. Enter your payment type. You can enter a voucher/coupon code and/or credit card.
    • Certification exams are taxable per local laws; you will see any applicable tax listed during the checkout process.
  9. Click Submit.
  10. You will see a purchase confirmation screen. Click Done.
  11. An email confirming your purchase and registration will be sent to you.

Salesforce Certification Verification

You can check your certification status on our verification page to keep track of your certifications, maintenance requirements, and account linking status.

Visit the Verification page and from the “Certification Holders: Check Your Status” box, enter your Webassessor email. You will receive an email showing your credentials, your required maintenance modules and due dates, as well as your Webassessor and Trailhead account linking status.

Salesforce Certification Training

There are many online resource available to learn salesforce for certifications. Easiest and cheapest way to learn salesforce is trailhead. Please go to trailhead and start learning salesforce.

Benefits of Salesforce Certification

Salesforce certification provides three important benefits to professional career

  • Salesforce Certification help you to increase your marketability in a tight IT job market and allow you to become a subject matter expert.
  • Salesforce Certification help you learning. When you study for Salesforce Certification, you will learn more things in detail. You get mote in-depth knowledge about Salesforce.
  • It help you in finding good Job. Employers prefer Salesforce Certified Professionals.
  • More Salary. Many Salesforce Salary surveys show that Salesforce Certified professionals get more salary compared to not certified professionals.
  • It helps in career growth.
  • It is not only important for individual professionals but also for Salesforce implementation partners in getting more business.

 

For more details about Salesforce certifications, refer to Salesforce Certification posts.

Permanent link to this article: https://www.sfdcpoint.com/salesforce/salesforce-certification-guide-to-pass-all-salesforce-certifications/

Git Commands With Examples

Git Commands With Examples

Git Commands With Examples

What is git?

Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals include speed, data integrity, and support for distributed, non-linear workflows.

Git is a free, open source distributed version control system tool designed to handle everything from small to very large projects with speed and efficiency. It was created by Linus Torvalds in 2005 to develop Linux Kernel. Git has the functionality, performance, security and flexibility that most teams and individual developers need. It also serves as an important distributed version-control DevOps tool.

Git Commands With Examples

 

Features of Git

  • Free and open source
  • Speed
  • Scalable
  • Reliable
  • Secure
  • Economical
  • Supports non-linear development
  • Easy Branching
  • Distributed development
  • Compatibility with existing systems or protocol

 

Git Commands

Here is list of important git commands:

  • git config
  • git init
  • git clone
  • git status
  • git add
  • git commit
  • git diff
  • git push
  • git pull
  • git branch
  • git checkout
  • git stash
  • git merge
  • git reset
  • git remote

 

Git Cheat Sheet

Here is our cheat sheet for git commands

Git Commands Cheat Sheet

Git Commands with examples

Let’s dive deep and check more details about each git command

Here is list of important git commands with examples:

git config

Usage: This command is used to set the author name and email address to be used with your commits. It sets username and email in main configuration file

Example of git config:

git config –global user.name “[name]”
git config –global user.email “[email address]”

 

git init

Usage: git init is used to initialize new git repository

Example of git init:

git init [repository name]

 

git clone

Usage: git clone is used to copy a repository from an existing remote URL. It also the remote to original source so that you can pull again.

Example of git clone:

git clone [url]

 

git status

Usage: git status check the status of files you have changed in your working directory which are not committed.

Example of git status:

git status

 

git add

Usage: git add adds a file to the staging area in your working directory.

Example of git add:

git add [file]

git add *

 

git commit

Usage: git add commits your changes in remote.

Example of git commit:

git commit -m “my sample commit message”

 

git diff

Usage: git diff shows the file differences which are not yet staged.

Example of git diff:

git diff:  git diff shows the file differences which are not yet staged.

git diff –staged: This command shows the differences between the files in the staging area and the latest version present.

 

git push

Usage: git push is used to send committed changes to remote repository repository.

Example of git push:

git push [variable name] [branch]: This command sends the branch commits to your remote repository.

git push –all [variable name]: This command pushes all branches to your remote repository.

 

git pull

Usage: git pull fetches changes from remote repository.

Example of git pull:

git pull [Repository Link]: This command fetches and merges changes on the remote server to your working directory.

 

git branch

Usage: git branch lists all the local branches in the current repository.

Example of git branch:

git branch: git branch lists all the local branches in the current repository.

git branch [branch name]: It creates a new branch.

git branch -d [branch name]: It deletes branch with branch name.

 

git checkout

Usage: git checkout is used to switch from one branch to another.

Example of git checkout:

git checkout [branch name]: This command is used to switch from one branch to another.

git checkout -b [branch name]:  This command creates a new branch and also switches to it.

 

git stash

Usage: git stash save changes that you don’t want to commit immediately.

Example of git stash:

git stash save:  save changes that you don’t want to commit immediately.

git stash pop: This command restores the most recently stashed files.

git stash list: This command lists all stashed changes.

git stash drop: This command discards the most recently stashed changes.

 

git merge

Usage: git merge merge two branches you were working on.

Example of git merge:

git merge [branch name]: This command merges the specified branch’s history into the current branch.

 

git reset

Usage: git reset undoes file or commit.

Example of git reset:

git reset [file] : This command unstages the file, but it preserves the file contents.

git reset [commit] : This command undoes all the commits after the specified commit and preserves the changes locally.

git reset –hard [commit] : This command discards all history and goes back to the specified commit.

 

git remote

Usage: git remote is used to connect your local repository to the remote server.

Example of git remote:

git remote add [variable name] [Remote Server Link]

 

For more details about git please refer this link

Permanent link to this article: https://www.sfdcpoint.com/salesforce/git-commands-with-examples/