Friday, 11 January 2019

How to get current user id in lightning web component | Access logged in user ID in LWC


 To get current user id in LWC we need to import the "@salesforce/user/Id" Salesforce module.

 Syntax :-
import userId from '@salesforce/user/Id';

Sample Code :-

 showUserId.html
<template>
    <lightning-card title="Show User Detail" icon-name="custom:custom15">
        <div class="slds-m-around_medium">
            <p>User Id: {userId} </p>
        </div>
    </lightning-card>
</template>

 showUserId.js
import { LightningElement } from 'lwc';
import strUserId from '@salesforce/user/Id';

export default class ShowUserDetail extends LightningElement {
    userId = strUserId;
}

 showUserId.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="ShowUserDetail">
    <apiVersion>45.0</apiVersion>
    <isExposed>true</isExposed>

    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
    </targets>

</LightningComponentBundle>

Output :-



Please check our old post on Lightning Web Components:-
Feel free to post your feedback or question.

Thanks,
Amit Chaudhary

Wednesday, 9 January 2019

Design attributes in Lightning Web Components | CSS and SVG Files | Lightning Web Components | targetConfigs



In our last post we talk about How to create first lightning web components and How to invoke apex class from Lightning web components. In this post we will talk about how to create design attribute in lightning web components.

We know how to create Design Attribute in lightning component. For Design Attribute we used to create <design:attribute tag in design file. But for Lightning web components we need to define the design attribute in Component Configuration File (XML) with<targetConfigs> tag. The component author need to defines the property in the component’s JavaScript class using the @api decorator.


We can use Design Attribute to make lightning web components attribute available to System Admin to edit Lightning App Builder or Community. 

Here is Sample code.

HelloWorld.html
<template>
    <lightning-card title={strTitle} icon-name="custom:custom14">
        <div>
            <p>  Hello , {firstName} </p>
        </div>
        <div>
            <template if:true={showImage}>
                <img src={imgUrl} width="200" height="200"/>
            </template>
        </div>
    </lightning-card>
</template>


HelloWorld.js
import { LightningElement, api } from 'lwc';
export default class MyComponent extends LightningElement {
    @api firstName ='Amit';
    @api strTitle ='Welcome in Salesforce';
    @api showImage =false;
    @api imgUrl ='';
}

HelloWorld.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="MyComponent">
    <apiVersion>45.0</apiVersion>
    <isExposed>true</isExposed>

    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
    </targets>

    <targetConfigs>  
        <targetConfig targets="lightning__HomePage,lightning__RecordPage">
            <property name="strTitle" type="String" default="Welcome in Salesforce" label="Enter the title"/>
            <property name="showImage" type="Boolean" default="true" label="Show Image ?"/>
            <property name="imgUrl" type="String" default="" label="Enter Image URL"/>
        </targetConfig>
    </targetConfigs>
   
</LightningComponentBundle>

Define the design Attribute in <property tag under <TargetConfig tag.

Please check our YouTube Channel Recording for same topic.

https://www.youtube.com/watch?v=oDj8R8QZdrg&t=1159s




 Please check our old post on Lightning Web Components:-
 
Feel free to post your feedback or question.

Thanks,
Amit Chaudhary

Capture.JPG  @amit_sfdc    #SalesforceApexHours    @ApexHours
  Salesforce Apex Hours


Monday, 7 January 2019

How to setup salesforce customer community | Setup and manage salesforce communities



Long time back we create one post of "How to setup salesforce community". In this post we will talk about step by step process to setup salesforce community. We will cover below topics:-

1) How to create Basic Salesforce Community with Community Builder.
2) How to create the Custom Content Layout with Lightning Component.
3) How to setup Salesforce Navigation Menu.
4) How to setup page Variations and audience in Lightning Salesforce Community.
5) How to setup/configure Snap-in Chat.
6) How to create Lightning Bolt Solution.


1) Setup Salesforce Community 

In this recording we talk about how to setup Salesforce lightning community and how to configure the community Theme, change color / font and Upload the community header/ banner image. We also talk about how to setup self registration in community.


2) Content Layout in Salesforce Community

In this recording we talk about how to create custom content layout for your Salesforce community.


3) Setup Communities Navigation Menu

In this recording we talk about how to create navigation menu/sub menu for your Salesforce community.

4) Page Variations and Audience in Salesforce Community

Audiences are sets of criteria used to define community member. Use them to keep your community members engaged by offering them personalized, relevant content. We can also create page variations that target specific audiences community (base on location, profile etc), and control who sees which page base on their profile and audiences criteria. Please check below recording for step by step process to setup page variations and audience in salesforce community.


5) Knowledge In Community

In this recording we can see how to configure the Knowledge and how to configure the Content / Articles for your Salesforce community.



6) Snap in Chat in Salesforce Community 

If you want to configure the Live agent with Snap-in Chat then check below recording. In below recording we talk about step by step process to configure the Snap-in Chat.



7) Lightning Bolt Solution

In out last post we talk about Lightning Bolt Solution.
Lightning Bolt - new framework for deploying next generation communities and portals quicker. Lightning Bolt for Salesforce allows you to quickly build and distribute industry-specific Lightning Bolt Solutions to jump-start new org capabilities. Save time by building once then reusing

If you want to create the Lightning Bolt Solution. Please check below recording.



Please share your feedback and let us know if you want to learn some new topic in Salesforce Community.


Thanks,
Amit Chaudhary
amit.salesforce21@gmail.com
 
 

Thursday, 3 January 2019

Inherited Sharing | Apex Inherited Sharing | Winter ’19


Now we can use "Inherited Sharing" in a apex class signature from Winter ’19. With "Inherited Sharing" we can run our apex code with both with or without sharing settings, depending on the context it is being called from.
  1. Allows the class to run in the sharing mode of the class that called it. If Apex class with Inherited Sharing is being called from some other class which is having without sharing setting, then it will run in without sharing mode.
  2. Enables you to pass security review and ensure that your privileged Apex code is not used in unexpected or insecure ways.
  3. If a class declared as Inherited Sharing, it runs as with sharing by default.
Example :-
Here is example of declaring an Apex class with inherited sharing and a Visualforce calling of that Apex code. With inherited sharing declaration, only contacts for which the running user has sharing access will display. But if the declaration is omitted, even contacts that the user has no rights to view are displayed due to the insecure default behavior of omitting the declaration.

Apex Class:-
public inherited sharing class Inherited_Sharing_Class{
    public List<Contact> getContacts(){
        return [SELECT Name FROM Contact];
    }
}

VF Page:-
<apex:page controller="Inherited_Sharing_Class">
    <apex:repeat value="{!Contacts}" var="record">
        {!record.Name}
    </apex:repeat>
</apex:page>


Thanks
Amit Chaudhary


Friday, 28 December 2018

Salesforce Apex Hours :- 2018


Happy New Year !!!

"Salesforce Apex Hours" is a recurring event to talk about Salesforce! Its a online event. After completing successful sessions in 2017 . We are happy that we have completed 24 successful online events in 2018 on below given topics. 

 
1) Big Object 

In that session we talk about need of Big Object and Consideration for big object Usages with Live Demo. We also also talk about limitation with big object.

Speaker :- Jigar Shah.
Agenda  :-
  1. Need for Big Objects
  2. Consideration for Big Objects Usage
  3. Demo
  4. Limitations with using Big Objects
  5. Q&A
  6. Additional References
Here is recording of Session.

https://www.youtube.com/watch?v=gV1Oviqzry0&t=160s




2) Spring 18 Lightning Component Framework Updates 

In that session we talk about new component in Spring 18 (Carousel , inputfield, outputfield, input address,list view ,record Edit form , Tree grid) and Using of flows in Lightning components with live demo.

Speaker :- Mohith Shrivastava
Agenda  :-
  1. New Base Components (Carousel , inputfield,outputfield,input address,list view ,record Edit form , Tree grid)
  2. Using flows in lightning components
  3. Demo
  4. FAQ
Here is recording of Session.

https://www.youtube.com/watch?v=cfcaN26qntQ&t=120s


3) External Services Salesforce 

In that session we talk about use of External Services with live demo.

Speaker :- Shruti Sridharan
Agenda  :-
  1. Introduction to External Services (Beta)
  2. Demo
  3. FAQ
Here is recording of session.

https://www.youtube.com/watch?v=dpspn5sVbIU&t=190s


4) Lightning Testing Service (LTS) 

In that session we talk about what is Jasmine and how to use Jasmine. We also did the live coding for how to use LTS with Consideration for Lightning Testing Service.

Speaker :- Jitendra Zaa
Agenda :-
  1. What is Jasmine
  2. Demo of Simple Jasmine Application
  3. Other Frameworks
  4. Considerations for Lightning Testing Service
  5. Q&A
Here is recording of session.

https://www.youtube.com/watch?v=YGeJjDRiqMg&t=185s


5) Basics of Einstein Analytics

On Sat, MAR 24, 2018 we organized session on “Basics of Einstein Analytics“. In this session we talk about what is Einstein Analytics with Demo.

Speaker :- Jitendra Zaa
Agenda:-
  1. What is Einstein Analytics
  2. Terminology
  3. Importing Dataset
  4. Creating Lenses
  5. Creating Dashboard
  6. Dashboard Tips and Tricks
    1. Steps
    2. Cross-Dataset filter (Connect DataSet)
  7. Dataflow Performance Improvement
  8. View SAQL
Here is recording of session.

https://www.youtube.com/watch?v=4w-YKceeLSk&t=210s


6) SSIS integration with Salesforce

On Sat, April 14, 2018 we organized session on “SSIS integration with Salesforce“. In this Session we talk about what is ETL and SSIS. How to connect Salesforce with SSIS.

Speaker :- Jitendra Zaa
Agenda :-
  1. What is ETL
  2. Introduction to SSIS
  3. COZYROC Connector
  4. Connecting Salesforce with SSIS
  5. Simple CRUD Demo
  6. Download attachments
  7. Upload attachments
  8. SSIS best practices
    1. Logging
    2. Configuration
  9. Q&A
Here is recording of session.


https://www.youtube.com/watch?v=RA5azDuubU4&t=110s


7) Platform Event

On Sat, MAY 19, 2018 we organized session on “Integrating with Salesforce using Platform Events“ with Jiger.

Speaker :- Jigar Shah.
Agenda :-
  1. Point to Point Integration Challenges
  2. Solution – Event Driven Architecture
  3. Understanding Platform Events
  4. Publishing & Subscribing to Platform Events
  5. Demo
  6. Q & A
Here is recording of session.

https://www.youtube.com/watch?v=pjFERotMm7o&t=10s


https://www.youtube.com/watch?v=pjFERotMm7o&t=10s


8) MuleSoft

On March 20th Salesforce signed a definitive agreement to acquire MuleSoft. This was Salesforce's largest acquisition ever at $6.5B. In the future this will be powering Salesforce's Integration Cloud. In this session we talk about what is MuleSoft with live demo.

Speaker :-Shree Mandadi , Mike Samboy , Amit Chaudhary
Agenda:-
  1. Technology overlap (Salesforce / MuleSoft)
  2. An overview the MuleSoft ecosystem
  3. How knowing MuleSoft can help a Salesforce Developer
  4. Where will the opportunities be for Salesforce developers
  5. What happened at MuleSoft CONNECT 18, what is the buzz.
  6. Q & A
Here is recording of session.

https://www.youtube.com/watch?v=r78_aBw4QoY&t=492s


9) Einstein Bots

On Sat, MAY 19, 2018 we organized session on "Einstein Bots". If you want to configure the same in your developer org please check this post for step by step process.

Speaker :- Shruti Sridharan , Amit Chaudhary
Agenda :-
  1. What’s all the fuss about Einstein Bots ?
  2. What are my per-requisites ?
  3. What is it made up of – Dialog, Slots and Entities
  4. Let’s Build One!
  5. Things to Remember
  6. Q & A
Here is recording of session.

https://www.youtube.com/watch?v=Z2v0Dv6nWaI&t=103s


10) How Lightning Platform Query Optimizer works for LDV

That online event was focused on importance of Salesforce's Query Optimizer and how it can help to improve the performance when dealing with Large Data Volume.

Speaker :- Jitendra Zaa, Sudipta Deb

Here is recording of session.

https://www.youtube.com/watch?v=FtfZV5uf9fg&t=150s


11) Lightning Bolt Solution

In this recording we talk about how to create Lightning Bolt Solution. Please check this post for step by step process.

Speaker :- Amit Chaudhary

Here is recording of session.

https://www.youtube.com/watch?v=pl7XkZt7bUk&t=30s


12) Einstein Platform Services

In that session we talk about what is AI and Machine Learning and Ket Concepts of ML. Overview of Einstein platform.

Speaker :- Prajakta Samant , Amit Chaudhary
Agenda :-
  1. What is AI , Machine Learning and Deep Learning
  2. Key concepts of ML
  3. Overview of Einstein Platform Services
  4. Demo
  5. Key Takeaways
Here is recording of session.

https://www.youtube.com/watch?v=_5bhpeMCc5Y&t=116s


13) How to Test Rest API Using POSTMAN | OAuth2

In this recording we talk about how to test REST API using postman with step by step process.

Speaker :- Amit Chaudhary

Here is recording of session.

https://www.youtube.com/watch?v=WdAhD6p1nKM


14) Salesforce Community

We Created multiple recording for "How to setup Salesforce Community".

Speaker :- Amit Chaudhary

Here is List of Recording:-
  1. Setup Salesforce Community (Part 1)
  2. Content Layout in Salesforce Community (Part 2)
  3. Setup Communities Navigation Menu (Part 3)
  4. Page Variations and Audience in Salesforce Community (Part 4)
  5. Knowledge In Community (Part 5)
  6. Snap in Chat in Salesforce Community (Part 6 )
https://www.youtube.com/watch?v=bowKDMQOzHs&list=PLaGX-30v1lh0yjm8UbB-4smaykJzCsH2y




15) Salesforce Report REST API

On 25 Sept 2018, “Salesforce Apex Hours” organized another successful Online session / event on “Demystifying the Salesforce reports Api“.

Speaker :- Jigar Shah
Agenda  :-
  1. Why use the Salesforce Report API?
  2. Features & Capabilities
  3. Salesforce Report API Basics
  4. Demo
  5. Q & A
Here is recording of session.

https://www.youtube.com/watch?v=kJD4d2xhKGY&t=1s


16) Setup SoapUI to Test Salesforce Webservice

In this recording we talk about how to configure SoapUI to test Salesforce Webservice.
Speaker :- Amit Chaudhary

Here is recording of session.

https://www.youtube.com/watch?v=zPBqHjZFHf4&t=1s


17) Einstein Analytics (Part 1)

We Scheduled the two session on "Einstein Analytics" with Rikke Hovgaard and we talk about basic of Einstein , Compare tables, custom maps, Action and Embedding.

Speaker :-  Rikke Hovgaard
Agenda :-
  1. How does the platform work – overview and concepts
  2. Introduction to the UI
  3. Compare tables
  4. Custom Maps
  5. Actions
  6. Embedding
Here is recording of session.


https://www.youtube.com/watch?v=6WNwOQjYm5c&t=189s


18) Einstein Analytics part 2


We Scheduled the two session on "Einstein Analytics" with Rikke Hovgaard and we talk about DataFlow SAQL with compare table and SAQL.

Speaker :-  Rikke Hovgaard
Agenda  :-
  1. Replication and dataflow
  2. A few binding use cases
  3. SAQL with compare table
  4. SAQL example
  5. SOQL example
Here is recording of session.

https://www.youtube.com/watch?v=LLXIpuePs0Y&t=83s


19) Salesforce DX for Non-Scratch Org.

In this session we talk about how to setup VSCode with SalesforceDX for Non-Scratch org. Here is Blog post for same.

Speaker :- Mohith Shrivastava
Agenda :-
  1. Scratch Org VS Sandbox Development
  2. SalesforceDX source code format from traditional format
  3. Winter 19 Salesforce Source Commands (Retrieve, Deploy and Delete)
  4. Using Salesforce Extensions For VSCode against Non-scratch orgs
  5. Auto Generating package.xml from change sets and un-managed package
  6. Setting Developer Workflows for Salesforce application development and debugging (ISV apps and change set based development)
  7. Deploying metadata from one org to another using Vscode extensions
Here is recording of session.

https://www.youtube.com/watch?v=dfAX2ec9py8&t=100s


20) Azure Active Directory Seamless Single Sign-On with Salesforce .

In this session we talk about Single Sign-on. And we did the SSO with Azure Active Directory.

Speaker :- Amit Singh
Agenda  :-
  1. Single Sign On
    • Delegated Authentication
    • Federated Authentication (SAML)
  2. Identity Provider (IP)
  3. Service Provider (SP)
Here is recording of session:- 


https://www.youtube.com/watch?v=sTBfRVSg82o&t=90s

 

21) Heroku Connect Deep Dive.

On 24 NOV 2018, “Salesforce Apex Hours” organized another successful Online session / event on “An in-depth look into Heroku Connect“.

Speaker :- Shruti Sridharan
Agenda :-
  1. What Problem Are We Solving
  2. Say hello to Heroku Connect
  3. Why Heroku Connect is the Best Choice
  4. Heroku Connect Setup
    •         Establish Connection
    •         Setting up Mappings
    •         Sync Data from Salesforce to Heroku Postrges
    •         Sync Data from Heroku Postrges to Salesforce
  5. Visualize data in Heroku Postrges
    •         Using DBeaver
    •         Using Simple Node.js App
  6. Checklist: Things to Remember
  7. References
  8. Q & A
Here is recording of session :- 

https://www.youtube.com/watch?v=2NiddbVE38g&t=4s


22) Lightning Locker Services.

On Sat, DEC 15, 2018 we organized session on "Lightning Locker Services".

Speaker :- Manish Choudhari
Agenda :-
  1. What is Lightning Locker Service?
  2. Why there is a need for Lightning Locker?
         -- Why do we say that browsers can be insecure?
         -- What is malicious JavaScript?
         -- What is cross-site scripting(XSS)?
  3. How it impacts your Lightning Components?
  4. How you can enable/disable Lightning Locker
  5. Demo
Here is recording of session.

https://www.youtube.com/watch?v=F1vQ7BqdUc0&t=200s


23) Lightning Web Components (How to create first LWC).

In this session we talk about how to setup Salesforce CLI with VSCode and how to create first Lightning Web Components. Check this post code.

Here is recording of session :-

https://www.youtube.com/watch?v=V_riFQU5iNA&t=1s


24) Invoke Apex Class from Lightning Web Component.

In this session we talk about how to invoke apex class from lightning web component and how to include one LWC into another LWC. Check this post for code.

Here is recording.



Thanks,
Amit Chaudhary
amit.salesforce21@gmail.com