Monday, 20 June 2022

Enable a LWC component to render in light DOM

 render lwc components outside of the shadow tree.


-> Enables global application styling

-> Ease 3rd party tools integration.


<template lwc:render-mode='light'>

    <my-header>

        <p>Hello World</p>

    </my-header>

</template>


import { LightningElement } from 'lwc';

export default class LightDomApp extends LightningElement {

    static renderMode = 'light'; // the default is 'shadow'

}


No Shadow root is created within the component.

Styles aren't scoped anymore.

Event's are retargeted.

<slot> elements aren't rendered in the DOM.

Second-generation managed packages

 SFDX :

Salesforce Developer Experience(DX) is command line interface which provides tools

to manage data and metadata on salesforce environments.


DH: Dev Hub :

Organization feature which provides access to create and manage scratch orgs and 

create and manage second generation package.


Package :

Bundled container of code and metadata which can be published on AppExchange or shared directly to subscribers.


2GMP :


Second-Generation managed package,created,developed and managed by SFDX CLI.


1GMP :


First-Generation managed package also known as classic package,created and managed from Packaging or Patch Orgs.


ISV :

Independent Software Vendor


The company, who releases the managed package.


NS :

Namespace is the prefix used by managed packages to isolate the metadata scope.


AppExchange :

Salesforce marketplace where packages can be found for installation or published by ISV.


Security Review :


Salesforce acknowledgement of managed package required for publishing on AppExchange.


NO :

Namespace Org, the org where namespace is registered.


PKO :


Packaging Org, the org where the package is created, built and registered.


PTO :

Patch org, the org where the patch version of package is developed and built.


Sbo :


Subscriber Org, the org where your subscriber clients install and use your package.


Sco :

Scratch Org i the source driven temporary disposable organization.


Push Upgrades :


Feature, which allows to push upgrades to the subscribers without their consent.


Package Version :


Package snapshot, which is defined by Major,Minor,Patch and Build Version.


How 2GMP are different from 1GMP ?


1. What is the source of truth ?


Source of truth : Packaging Org vs VCS


2.Who is the owner of package and metadata?


Owner of package and metadata : Pko vs DH+VCS.


3.How many packages may belong to an Org?


Number of Packages per org : 1 vs many


4.Where is the namespace registered?


namespace : PKO vs Namespace Org(NO) linked to DH.


5.How many packages may share namespace?


Number of package per NS : 1 vs many


6.Which are the options to share code?


Share code : global or @namespaceAccessible


ex :

@namespaceAccessible

public with sharing class JQ {


public class InvalidJSONQueryException extends Exception{}


@testVisible Map<String,Object> internalRepresentation;

@namespaceAccessible

public JQ(String data){

  internalRepresentation=(Map<String,Object>)JSON.deserializeUntyped(data);

}


}


7.Can package create or uninstall be automated?


SFDX commands can be used to create or uninstall.


8.Is branching supported in package versioning?


Package versioning : linear vs branching


9.How patch versions can be created?


Patch versions: Patch Org vs VCS



which functionality is supported in 1 GMP but not in 2 GMP?


1.Components can't be deleted from packages.

2.Package versions can't be deprecated.

3.Apex versionProvider isn't supported.

4.A default language for labels in packages can't be specified.


Q)SFDX CLI command to create a new package version fails to be create because of exceeding limit Package2VersionCreates,

but developer needs to create a new version urgently for a client.What developer can do?



sfdx force:package:version:create --skipvalidation


Include --skipvalidation switch in the SFDX CLI command

Skip validation during package version creation;

you can't promote unvalidated package versions


However,unvalidated package verions have a separate limit which has 

much higher value even for free developer orgs.The value of Package2VersionCreatesWithoutValidation is 500

While the value of Package2VersionCreates is 6.


Sunday, 19 June 2022

Transaction Security Policies in Salesforce

 Transaction Security is a feature that monitors Salesforce events in real time and applies actions and notifications based on rules you create. These rules, or policies, are applied against events in your org.(ex : our policy was to have no more than three active sessions per user.) You create policies for certain event combinations, and specify actions to take when those events occur.

Using Transaction Security Policy, you can define events to monitor and take action when that event happens. 

Here are a few examples of the events that you can monitor.


1.You want to block and notify the administrator when somebody tries to export the ‘Contact’ information

2.You want to raise the session security to Two-Factor Authentication (2FA) 

  when a user tries to access Salesforce from two different IP Address within the last 24 hours

3.You want to block the access when someone tries to login from a particular country or from a particular operating system or browser

4.You want to block chatter posts containing particular keywords

5.You want to limit the concurrent number of sessions for a user or for an administrator


And when these events occur, you can take these actions


1.Block – Don’t let the user complete the request

2.Two-Factor Authentication – Step up the security and prompt the user to confirm identity by using two-factor authentication, such as the Salesforce Authenticator app

3.Freeze user – Prevent further logins into your org by the user.

4.End session – Prompt the user to end an existing session when the number of concurrent sessions a user is allowed to have is strictly limited.

Note :

 Transaction Security is a framework that intercepts Salesforce events in real-time and applies appropriate actions and notifications  based on the security policies you create. 

 

 Transaction Security Policy requires purchasing 'Salesforce Shield' or 'Salesforce Event Monitoring' add-on subscriptions. 

 

Saturday, 18 June 2022

PICKLISTCOUNT Function in Salesforce

 Salesforce has an undocumented function called PICKLISTCOUNT. This function returns the number of     selected values in a multi-select picklist. This function is helpful in validation rules.

Use case: Salesforce users with ABC profile can select only one value in a multi-select picklist field.

Validation Rule: PICKLISTCOUNT( MultiSelect_Picklist__c ) > 1 and $Profile.Name is ABC

Sunday, 5 June 2022

Restriction Rules and Scoping Rules

 Restriction Rules :


Using restriction rules we can apply an additional level of filter on top of records to which a specific user is having access.



Scoping Rules :


Scoping rules help to filter the default records visible for a user based on specific criteria. But it is not preventing access to other records.