Monday, 29 April 2019

Salesforce DX Understanding



    1. What is Salesforce DX?


    Salesforce DX (Developer Experience) is tool with the ability to consider source code management as source of truth.Source-Driven Development.This allows users to develop and manage Salesforce apps across the entire platform in a more direct, efficient way.
    Build together and deliver continuously is tag line for Salesforce DX.

    Note : For Changeset, Metadata API or Force.com IDE, source of truth is Sandbox.

    Implement  By :
    1. Salesforce CLI [Command Line Interface] / Salesforce Extension for VS Code (Light weight editor) : You can use the CLI or Salesforce Extensions for VS Code to open your scratch org in a browser without logging in.
    2. Scratch Orgs : The scratch org is a source-driven and disposable deployment of Salesforce code and metadata.Facilitate's automated testing and continuous integration.

    2. Why is it ?Why your client start adopting it?

    • Current metadata is not isolated or organized in a way that makes it easy to upgrade and maintain.
    • SFDX force to create a well defined packages, Which are versionable and easy to maintain, update, install, and upgrade. With this updates and customization are much easier to manage across your development team
    •  Automated Data load between Orgs For Testing : We can avoid lot of  manual work with data loader and other tools usage
    • SFDX is future because its Salesforce official tool, So adopting to it is advisable
    • SFDX packages for everyone (Customer/SF partner/Consultant/Contractor),Not like earlier packages were traditionally only for  Salesforce Partners

    3. What is Artifacts?


    An artifact is a group of related code and customization's.

    4. What is SFDX Architecture?



    5. Why Salesforce is focusing on Source based development now ?
    1. The use of version control is at the heart of all modern development practices(.Net/Java). 
    2. It’s the basic prerequisite for automating deployments, testing, quality and security analysis.
    3. Most important work will not be lost.
    6. What is the Dev Hub, Scratch Org?What is Scratch Org ? What is it's lifespan?

    Dev Hub : Allows you to create and manage scratch orgs.

    Note : This can be enabled in any paid(Prod/Business) org & Also in Developer /Trail Org

    Scratch Org : This is a source driven and disposable deployment of Salesforce code and metadata,Made for developers and automation.

    Life Span: Scratch Org are ephemeral in nature,Max - 30 Days,Default - 7 Days

    7. Is there any additional cost to enable Dev Hub ?

    No

    8. How to setup SFDX ?
    1.Enable Dev Hub
    2.Create Scratch Org
    3. Install Salesforce CLI,Download
    4. Install Salesforce Extension for Visal Studio Code,Download
    5. Install Git Hub / Other source safe,Download

    9. What is Salesforce CLI ,Mention few key benefits & Installation guidelines?


    Salesforce CLI: This is a powerful command line interface that simplifies development and build automation when working with Salesforce Org.

    Key Benefits :
    1. Package development process from the command line.
    2. This is "Salesforce CLI" not the "Salesforce DX CLI" ,Which means this can be used against any org not only to Scratch Org.
    3. This combines many capabilities from across several  Salesforce API's
      • Metadata API
      • Tooling API
      • Data(SOAP) API
    4. It also supports the functionality of  ANT migration tool,Which allows scripting the metadata tasks. 
    5. Synchronize source to and from scratch orgs
    6. Create and Manage orgs
    7. Import and Exports data
    8. Create and Execute tests
    9. Create and Install packages 
    Installation Guidelines :
    1.After successful installation,An exe file should be available in below path
    Go To --> C:\Program FIles \ Saleforce CLI \ bin

      2.Add environment path variable
    Go To --> Windows Search --> Edit Environment Variables For Your Account


    10. What is Salesforce Extension for VS Code?
    This extension pack includes tools for developing on the Salesforce platform in the lightweight, extensible VS Code editor. These tools provide features for working with development orgs (scratch orgs, sandboxes, and DE orgs), Apex, Aura components, and Visualforce.

    11. Is there any limit on number of Scratch Org Creation ?
    Yes,To ensure optimal performance.
    Active Scratch Org Vs Daily Scratch Org
    1.Active Scratch Org : @ any point you can not have more than the number of active (Non-Expired & Non-Deleted) scratch orgs as given below based on license.
    2. Daily Scratch Org : These are the allowed number how many can be created each day.
    Ex: 200 for unlimited But can have active 100,So delete 100 and create new 100,Again u can delete upto 100 and allowed to create new 100 per day.After that if u delete 1 and try to create new 1 it will not allow since you have completed daily quota of 200 scratch org creation,Need to wait till next day.



    12. Scratch Org VS Sandboxes?


    Scratch Org compliments Sandboxes but do not replace them.


    Sandbox
    Scratch Org
    Immortal (Living forever) in nature
    Ephemeral (Lasting for very short time) in nature
    Production,Integration Testing,Full Copy staging will use sandbox
    Development,SIT phase best to use Scratch Org
    All developers of the project team work in same org,Difficult to track the changes done by individual.
    Each developer will have a dedicated scratch org which helps easy tracking of changes.
    Sandbox doesn’t support “Source Synchronization”.
    Ex:If developer miss to commit few changes from org to version control will lose the track & Later face difficulty while deployment and it’s very difficult to find under development for a long time.
    Scratch Orgs support "Source Synchronization", which means you can just run `sfdx force:source:pull` and `sfdx force:source:push` to synchronize metadata between version control and your org.

    13. Version control,CI CD can be done using Sandbox based development process also then why SFDX ?

    Yes,Many clients are already setup version control and CD using Sandbox based dev process.But in that scenario,version control necessarily lags behind the development org,
    And development sandboxes are the actual source of truth.That can be overcomes by using SFDX.The scratch org are ephemeral which forces developers to not relay on the org,But instead to persist their work in version control.

    14. SFDX Pros and Cons ?


    Pros :
    • SFDX force to create a well-defined packages, Which are versionable and easy to maintain, update, install, and upgrade. With this updates and customization's are much easier to manage across your development team
    •  Automated Data load between Orgs For Testing : We can avoid lot of  manual work with  data loader and other tools usage
    • SFDX packages for everyone (Customer/SF Partner/Consultant/Contractor),Not like earlier packages were traditionally only for  Salesforce Partners
    • It provides with an integrated, end-to-end lifecycle designed for high-performance agile development
    • It tracks any change you make locally in the project and any changes you have made in your scratch org
    • Reduced integration/testing time due to rapid setup of Scratch Orgs
    • Facilitates automated testing and continuous integration
    • Environments are easily created and disposable
    • Use any tool to modify code (CLI, Vim, Sublime, Atom etc)
    Cons :

    • Modularizing packages is very challenging for the existing big project
    • New tool & Few features might be missing but there is continuous improvements going on this
    • Takes bit of time to adopt,New development cycle & Technology as VCS as source of truth instead of sandbox 
    •  Significant learning & understanding is needed to start with
    • Salesforce CLI installs locally
    •  If your application involves building an extension package on top of existing managed package applications like Health Cloud, CPQ ,Financial cloud etc .Some of these apps require specific permission set licenses that are not available in scratch orgs yet .Also these apps involve too many customization that its almost easier to create sandbox environment from Trialforce templates for development than scripting all these via DX .(Safe Harbor — There are snapshots and templates features thats planned this might go away)

    15. What is mean by SFDX keep track of Local & Scratch Org changes automatically?Then why do we need push and pull ?
    It will keep track of changes and push or pull only those changes when command is performed ,
    It will not do auto sync but keep the track of changes.

    16. Why do we need to modularize the package ?
    If we have more projects in one production org definitely have more metadata components.
    And we will not able to say which metadata is part of which project.Maintenance is difficult.
    Ex: 10K metadata components and modifying of one component not sure
    where it will be impacted
    Note : If we maintain naming conventions that may help to some extent to find the grouping
    & Dependencies.


    17. SFDX Limitations & Workarounds?
           Refer


    18. List few Salesforce CLI commands ?
     

    Salesforce CLI Command
    Details
    List all available CLI commands
    Sfdx force:doc:commands:list
    To open scratch org,
    The default user is admin without password,If requires password.
    Note : Try this user login from other system CLI
    sfdx force:org:open -u test-rnfwyhrua8ed@example.com
    push (synchronize) your new code from local folder to the scratch org
    sfdx force:source:push

    synchronize changes in your local project to a scratch org with the alias MyScratchOrg

    sfdx force:source:push -u MyScratchOrg

    To open the scratch org
    sfdx force:org:open
    Pulls the latest from scratch org to local folder
    sfdx force:source:pull
    Create a project
    Ex:MyNew App
    Sfdx force:project:create -n MyNewApp
    Data transfer
    Ex:Existing accounts
    Sfdx force:data:tree:import -sobjecttreefiles data/Account.json
    Show the expiration date of scratch org
    sfdx force:org:display
    Create a new Apex
    Ex:NewClass
    Sfdx force:apex:class:create -n newClass -d force-app/main/default/classes
    Create new lightning component
    Sfdx force:lightning:component:create - Listview -f force-app/main/default/aura


    SFDX CLI command sfdx force:auth:web:login will not work if you’re trying to login to a sandbox org. This will open up a window to login.salesforce.com 
    Solution :
    sfdx force:auth:web:login -r https://test.salesforce.com

    sfdx force:auth:web:login -r https://test.salesforce.com -a DevSandbox

    19. Use of "sfdx-project.json"?
    Information required to track source and metadata with your scratch org
    A Salesforce DX project has a specific structure and a configuration file that identifies the directory as a Salesforce DX project.
    • sfdx-project.json
    • config/project-scratch-def.json
    • .forceignore

    20. What are the different types of packages available in Salesforce?


    Package Name
    Details
    Managed Package
    • Managed packages are typically used by Salesforce partners to distribute and sell applications to customers.
    • Using the AppExchange and the License Management Application (LMA), developers can sell and manage user-based licenses to the app.
    • Managed packages can be upgraded in the installer's organization. 
    • Some components are locked, ensuring a smoother upgrade process.
    Unmanaged Package
    • Unmanaged packages are typically used to distribute open-source projects or application templates to provide developers with the basic building blocks for an application.
    • Unmanaged Packages cannot be upgraded in the installer’s organization.
    • Unmanaged Packages do not include any locked components,Its open to edit code.
    2nd Generation Package

    Locked Package

    Unlocked Package



    21. Any additional cost for Salesforce DX ?


    No,There is no additional cost.

    22. What is Appirio DX ?


    AppirioDX commands like adx sfdx:init can help by automating the entire process of creating these orgs, installing packages, pushing metadata, sample data, and configuration data, and assigning permission sets.


    Reference:




    Thursday, 17 January 2019

    SFDC Solution Lead Exp


    1.Omni-Channel Case assignment to Agent not triggering Case WF/PB update condition?


    Omni-channel does not support Escalation Rules or the firing of field updates when a record is routed from an Omni Queue and accepted by an Agent. 

    Solution
    AgentWork (Object): It represents a work assignment that has been routed to an agent.

    1. Write trigger on this object "AgentWork"
    2. Get the Agent User & WorkItem (Case Details)
    3. Once got the Case Id perform the required logic which wanted to do through WF/PB.


    2.One of the Custom Object not able to find from Object Manager / Profile page but from Query Window able to see?How to figure out ?


    1.Enter the ID in the URL after Salesforce.com/ --> This will take you to the record directly from there can figure out easily
    2.Verify is that Custom Object / Custom Setting and search accordingly 
    3.Verify the Custom Object API name and Label name are same or not.If not find the label name and search accordingly
    system.debug(SObjectType.MyApiName__c.getLabel());


    3.What are the ways to export the data model of a Salesforce instance ?

    1. Lucidchart - Licensed [Salesforce schema connector is been added to it ],It gives the relation ship details [Master-Detail / Lookup]

    1. Schema Builder - Salesforce
    2. Field Dumper - App Exchange
    3. ERD - Tool - App Exchange


    4.External Http Callout Limits,

    Requirement : On object every record create /update send details to external system,External System Exposed REST API,What is your design approach and how you take care of Governor Limits?


    Design / Solution :

    1. Confirm again the requirement on every record create / update needs to trigger call out to external system or Can be consolidate and send a bulk request ? Why this is important is
       --> The Target application may have an API restriction,So sending one request on each create and update may hit their limit
       --> Handling bulk data is the technically the clean way of approaching it when working on clouds
      --> If it has multiple external system need to listen to the changes ,See the design of Publish-Subscribe model

    2.If the external system application has SOAP API also,Then Outbound Message is suitable.Confirm with the client on this SOAP API availability.

    3.If the requirement is exactly as mentioned in question and there is no possibility to send bulk request & There is no SOAP API then write the Apex Call out.

    4.External Http Callout Limits : Any action that sends a call to the API counts toward usage limits, except the following:
    -->  Outbound messages
    -->  Apex callouts

    Apex callouts are exempted from limits for total API requests and concurrent requests. but has transaction or cumulative time-based limits (Check Salesforce Documentation for limits)

    Note :You can make as many callouts to Google API etc or any of your Enterprise Application web services APIs in a day, only thing is you have to take care of how many callouts to these services are allowed on an hourly, daily or monthly basis depending on the limits in these systems as mentioned in their documentations mostly.

    5.Inbound call API usage limit Every inbound call into the API counts against your 24 hour limit - note: the limit is per 24 hours, not per day - the difference is that if you make 10,000 API calls at 11:01 GMT today, those calls are removed from your count at 11:01 GMT the next day, not at 00:00 GMT.

    6.System Overview : Use this option to see the current API usage

    Reference

    5.How to share Activity record [Task/Event] ?

    • In Sharing Setting OWD of Activity object can be defined as Private or Controlled by Parent 
    • Activity object cannot be shared by Sharing rule and this object doesn't have Sharing table at all.
    To share the calendar with other users


    1.Personal Setup-->My Personal Information-->Calendar Sharing  


    2.The "Related To" and/or "Name" field must be completed,Or the
      Activity will be deemed Private regardless of other sharing settings(Such as Calendar Sharing)
    Reference

    6.Case Document Attachment Notification to owner when attached by other user?

              There is no standard OOB / Can't be achieved through configuration feature.

    Customization  Approach:
    When attachment added to a record it will be saved into Content Document object in Lightning.

    Note : Content Document is not supported in WorkFlow / Process builder
    So required customization

    Steps :
    1.Write trigger on Content Document.
    2.Get the sObject record id from ContentDocumentLink by LinkedEntityId
    Note : It creates 2 records 1 for sObject link & Other User link who created
    3.Find the record owner
    4.Send and email alert with the below details
        Document Attached By
        Document Attached Date & Time
        Case Number #

        Title Of the Document 

    7.The Src value is hardcoded in the javascript ,It will cause issue every time u migrate the code to different environment?


    </script>
    Instead  of that try like below --> Configure into static resource and try to access.

    <script src="{!$Resource.MyJSFile}" type="text/javascript"  ></script>

    Note<apex:includeScript value="{!$Resource.JSName}"/>

    Has some performance issue so better is to use like above.

    Tuesday, 8 January 2019

    Salesforce Online Proctored Certification Exam - My Exp & Tips

    1. Why do i choose online Proctor option ?

    Since i was at my home town and don't have any Kryterion Test center in that location to give onsite proctor.


    2. Install Kryterion Sentinel software ?

    This installation is must.
    Note : This installation option comes only after you register exam as online.




    3. Enroll In Biometrics?

    Click on the button "Enroll In Biometrics" which will do facial reorganization to verify your identity.




    4. Web Cam setup ?

    Requires external web cam.I used "Logitech HD Webcam C310".

    1.Disable the inbuilt web cam
    2.Enable the external web cam
    3.Web Cam should be in 45 degree angle,Refer below link for position [Step 2]



    5. Web Cam Microphone Testing?


    6. Internet Speed Test ?

    Click on below link --> Select the host from the below drop down of go button --> Enter "Phoenix" --> Select "Cox-Phoenix" --> Click on Go button


    Please double check speed test is successful as per below mentioned condition.

    Note : With out this conditions satisfied Sales-force Team will not allow to take the test online.

    1 Mbps upload / 1 Mbps download / Jitter should be <50ms (Ping <200ms)


    7. How to contact support if any issues?

    The support team is very helpful & quick,Enter your details in the mention form and submit.