Sunday, 20 April 2025

How to use `Array.prototype.flatMap()` with `destructuring` to unzip an array of pairs into two separate arrays.

 Using `flatMap()` and destructuring, we can achieve this in a neat one-liner.


1. We’re mapping over the indices `[0, 1]`, which correspond to the two elements in each sub-array.

2. For each index, we use `flatMap()` to extract the element at that index from each pair. This gives us one of our desired output arrays.

3. We then use array destructuring `(const [numbers, words] = ...)` to assign the two output arrays to separate variables.


ex: 

const pairs = [[1,’one’],[2,’two’],[3,’three’]];

const  [numbers,words]=[0,1].map(index => pairs.flatMap(pair => pair[index]));


console.log(numbers); // [1,2,3]

console.log(words);    // [‘one’,’two’,’three’]

Wednesday, 16 April 2025

Salesforce Experience Cloud

 Experience Cloud Authentication Groups :


1.Guest Users

 Represents all Unauthenticated users (I.e., the public)

2.External Users

Partners and customers users that do not have a ’Standard’ license

3.Internal Users

Employees and contractor users with a ’Standard’ license.


Membership : 

Junction of a user & an experience ; grants a person access.



Customer community, customer community plus and partner community constitute the vast majority of used experience cloud licenses.


Commerce Portals : Similar to Customer Community, less standard objects,  more custom objects.


External Apps : similar to Partner, more storage, API calls, custom objects.


Channel Account : Same as partner, but billed per partner (instead of per user)


Named User vs User Login Licenses :


Named User :

Named, dedicated user record; associated with all corresponding logins over time.


User Login :


Not named or dedicated to one person; associated with an instance of authenticated access.


Setup a Experience Cloud Users :


  1. Employee : Create user from Users setup.
  2. Customer : Create user from Contact record.
  3. Partner : Enable account, create user from contact


Key Elements of a Experience Cloud Template

Theme, Pages, components and configuration


Org Settings that impact Communities :

  • Chatter
  • Feed Tracking
  • Topics for Objects
  • Knowledge


Key Communities Settings


  • Community Domain (required)
  • Enable ExperienceBundle Metadata API
  • Enable Partner Super User Access
  • Allow using standard external profiles for self-registration and user creation
  • Enable Account Relationship


Community Data Security Elements

  • Object & Field Access

Access is granted to users through profiles or permission sets.

  • Organization - wide Sharing

Organization-wide default (OWD) sharing determines record visibility, by default


Four primary settings for OWD sharing are : 

Private

Public Read Only

Public Read/Write

Controlled by Parent


Internal and external defaults can differ; external cannot be more open than internal.


  • Record Sharing

Builds on OWD sharing settings.

Granular record sharing can be facilitated in various ways:

  • Manual (one-off; share x with z)
  • Sharing rules (if x=y, share x with z)
  • Apex sharing (advanced sharing rules)

Record sharing can only be applied to external users with specific licenses:

  • Partner Community
  • Customer Community Plus


  • Sharing Sets

Sharing Sets are unique to communities.

Can be used for sharing with users of any external licenses type (Partner/customer).

Applicable to objects with an OWD sharing setting of Private or Public Read only.

Logic requires either a contact or account lookup on shared item and user sharee.

Sharing Sets are not community-specific but instead map to profiles.


  • Share Groups

Share Groups share the data of HVP users whose profile is included in a sharing Set.


The objects configured in the sharing set are ignored; all shared records are affected.


The users with whom data is shared can be identified by user, role or group.


The users with whom data is shared can be internal or partner users.


  • Account Relationships


Allows for relationship-based sharing in a multi-level community.

Enables data associated with a ‘sub-partner’ to be shared with a partner.

Streamlines the management of data visibility in a more complex community.


Topics in Communities :


Topics provide context and show relevance.

They serve as the glue between various elements within a salesforce community.

Topics can be associated with various data types, including :

  • Knowledge articles
  • Standard and custom objects
  • Chatter posts
  • Files
  • User (Knowledge Experts)


Knowledge in Communities :


Knowledge is a paid offering that surfaces articles via a self-service knowledge base.


It plays a critical role in many partner, customer and employee communities.


Two versions are available

        

          1.classic ( with Article Types)

           2.Lightning (with Record Types)