Tuesday, 31 December 2024

pause and resume scheduled jobs programmatically

 Salesforce Spring ’25 release, 

Apex developers can now pause and resume scheduled jobs programmatically! 


This highly anticipated feature enhances job management, offering more flexibility in handling scheduled tasks.


How It Works:

 1. Pause Scheduled Jobs:

Use the System.pauseScheduledJob(jobId) method to temporarily halt a scheduled job.

 2. Resume Scheduled Jobs:

Resume the paused jobs using System.resumeScheduledJob(jobId) without needing to delete or reschedule.


Key Benefits:

 • Improved Control: Manage job execution more effectively during maintenance or troubleshooting.

 • Increased Flexibility: Avoid manual rescheduling by pausing and resuming jobs as needed.

 • Streamlined Maintenance: Ensure system performance by pausing non-critical jobs during peak times.


This update is especially useful for admins and developers managing high-volume or critical environments. It eliminates the need to delete and recreate jobs, saving time and effort.


Here’s how you can pause and resume scheduled jobs using Apex in Salesforce:


Example Code:


// Get the ID of a scheduled job

String jobId = 'YOUR_JOB_ID_HERE'; // Replace with the actual job ID


try {

 // Pause the scheduled job

 System.pauseScheduledJob(jobId);

 System.debug('Scheduled job paused successfully.');

 

 // Resume the scheduled job

 System.resumeScheduledJob(jobId);

 System.debug('Scheduled job resumed successfully.');

} catch (Exception e) {

 System.debug('Error: ' + e.getMessage());

}


Steps to Use:

 1. Replace YOUR_JOB_ID_HERE with the actual job ID, which you can find using System.scheduleJobs or by querying the CronTrigger object.

 2. Execute the code via the Developer Console or include it in your Apex class or trigger.


Notes:

 • Ensure the job is active before attempting to pause it.

 • Paused jobs can be resumed without needing to reschedule them, saving time during system maintenance or debugging.

 • Permissions: Verify that the user executing the code has appropriate permissions to manage scheduled jobs.


This new functionality simplifies scheduled job management, enhancing operational efficiency and flexibility!   


Sunday, 29 December 2024

Basics of Experience Cloud

 Salesforce Community Templates :


A Salesforce community template is essentially a starting point for a new community.

Standard templates are provided by Salesforce, and custom templates are available from partners.


four main elements in a community template:

1.Theme

2.Pages

3.Components

4.configuration

There's a theme, which provides the overall look and feel, the pages, the components that can go on those pages or are simply available for use, and finally, the configuration of those components that are on the pages.


Fundamental Elements of Community :


1.settings : Overall and Community-specific

2.Sharing & Visibility : Community data access

3.Topics & Chatter : Organized Collaboration

4.Knowledge : Curated articles for a Community

5.Personalization : Audience targeting specific items

6.CMS Content : News,images , documents etc.


some key org settings that impact communities:


These are located in various places within Setup. Some noteworthy settings include Chatter, Feed Tracking, Topics for Objects, and Knowledge.

 

Key Communities Settings:

Communities settings are available after initially enabling communities overall.

- Community Domain(required)

This sets the base domain for all of the communities in your org. 

It can be overwritten with a custom domain, but this is the standard approach for setting your community domain.

-Enable ExperienceBundle Metadata API

This allows you to take advantage of a text‑base representation of different settings in your community, such as pages, branding sets, and themes.

-Enable Partner Super User Access

which is very useful if you want to grant one or multiple users additional access in your org. This allows these users to access more data and records, regardless of sharing rules and organization‑wide defaults.

-Allow using standard external profiles for self‑registration and user creation.

-Enable Account Relationships

which allows sharing between partner accounts.


Community-specific settings :

-main settings

which control the name and URL of the domain

-Preferences

-Members & Contributors

-Login & REgistration

-Emails

-Pages


Sharing & Visibility :

Data security must be considered a top priority within any community.


Community Data Security Elements 

1.Object & Field Access

2.Organization-wide Defaults Sharing

3.Record Sharing

4.Sharing Sets

5.Share Groups

6.Account Relationships


Community Membership

can you access the community?

Object Permissions

Can you access the object?

Field Permissions

Can you access the fields?

Sharing/Visibility

Can you access specific records of this object?


Object and Field Access :

Access is granted to users through profiles or permission sets.

Organization-wide Default Sharing Settings :

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, eternal cannot be more open than internal.


Record Sharing :

Builds on OWD sharing settings

Granular record sharing can be facilitated in various ways:

- Manual

- sharing rules

- Apex sharing

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 license 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 user with whom data is shared can be internal or partner users.


Account Relationship Sharing :

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 e associated with various data types,including

- Knowledge articles

- some Standard and Custom objects

- Chatter posts

- Files

- Users (Knowledgeable Experts)


With Topics you can associate them with files,articles,chatter posts ,object records,and they connect that content and data with users.


Groups in communities:

These are a feature of Chatter, which is a feature that has been around on the Salesforce platform for quite a while.

 In communities, however, groups have high relevance as they enable contained conversation.

 These groups can be public, private, or unlisted, and all standard Chatter functionality is supported with some additional functionality available for groups.

 

Audience Targeting in communities:

Audience targeting allows for seamless personalization of web elements.

Audiences can be constructed with various data points,including :

-User record (including related data)

-User Profile

-Location (IP-based)

-Domain

Personalization supports advanced setup via API, but code is not required.


Audience Targeting Methods:

1.Page Variations

which allows you to show a completely different page to multiple audiences.

2.Components 

components, which allows you to focus on one or more components on a particular page; this is beneficial if you want subtle, small changes and not a completely different page for a user.

3.Branding Sets

controls the overall look and feel from multiple users.


CMS and Content for Communities:

Enables advanced authoring and management of content.

Allows content to be shared with multiple targets and managed centrally.

can be associated with topics within a community.

Community Cloud is one potential channel: content can be shared with other systems.


CMS Content Types

News

Image

Document


Workspaces and channels are also important aspects of CMS.

Workspaces essentially allow you to define channels and determine where the content from each workspace can be delivered.


CMS Connect in Communities :

A low-code option to consume content from outside content management systems.

Useful for organizations looking to keep an existing CMS but using Salesforce for communities.

Supports multiple layers of content for a seamless user experience; e.g. blog posts have their own detail pages.


CMS Presentation Control in Communities:

Separates data and presentation layers.

Enables admin-friendly configuration of front end user experience elements.

supports single-item and list display.


Experience Cloud License and membership

 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 contractors : users with  a standard license.


Note :

Unauthenticated access to a Salesforce community does not require a license.This applies to Guest users.



Membership : Junction of the user and a community. And this grants a person access.


The keys to Community Membership :


A license is required for authenticated community membership.

A user profile associated with an appropriate license type must exist.

A user record must be created with an applicable user profile.

When a user profile is added to a community,all users with that profile are now licensed users of that community.


Permission Sets :

Granting an individual access to a community can be done via permission sets.

Allows maintenance of existing profiles without providing unnecessary access.

Permission Set access is used less often than granting access via user profiles.

This would typically be used as an exception, not the standard for access.


License Types and Capabilities :


1.Customer Community 

Customer community provide access to a few key standard objects,

such as accounts,contacts,cases,products and orders, upto 10 custom objects.

chatters, files and knowledge (read-only)


2.Customer community plus

Customer community plus takes everything that customer community has and adds a few key additions.

Additional Read/Write access to standard objects.

Reports and Dashboards

Roles

Advanced sharing

Additional Data Storage

Additional API Calls

Delegated Admin


3.Partner community

Partner license types provide everything that customer community plus has along with access to additional standard objects.

leads,opportunities

Also some additional data storage and territory management.


4.Commerce portals

Similar to Customer Community.

with less standard objects and more custom objects.


5.External Apps

it's similar to Partner,has more storage , API calls , custom objects(100).


6.Channel Account

Same as Partner, but billed per partner instead of per user.


upgrade paths between community licenses :


Quick & easy Upgrade path :


From Customer Community to either customer community plus or Partner community.

This upgrade is fairly straightforward.


Multi-step Upgrade path :


possible Upgrade between Customer Community Plus and Partner.however, it takes a little bit more work to make that happen.


To take a user who has a Customer Community Plus or a Partner license and move them to Customer Community 

requires a significant amount of work and is not a standard upgrade path.


Named User vs User Login Licenses :

A named user license, or simply user, is associated with a named, dedicated user record and is associated with all corresponding logins over time.

The user login license type is not named or dedicated to one person. It is associated with an instance of authenticated access.

 

The named user license type is acquired and is associated with an individual user. That user logs in. Let's say that user logged in four times in a month. The license count, however, will only be 1 because all 4 logins are associated with the named user.

The user login scenario is different. This user logs in 3 times in a month, and each of those is added to the total, which is 3. So a user with a user login license type that logs in 3 times uses 3 licenses in that month.

 

Note :

A fully optimized license allocation assumes a named user assignment for users that have 3+ logins/month.


Friday, 27 December 2024

How to Reset Salesforce Flow Limits

 How to Reset Salesforce Flow Limits That Cause Errors Like "Number of Iterations Exceeded" or "Apex CPU Time Limit Exceeded" 


The limits are reset when the flow transaction ends. To end the transaction, we can perform these steps :


1. Autolaunched Flows :

• Pause Element: Set to 0 hours to end the transaction and clear limits.


2. Screen Flows :

• Screen Element: Ends the transaction after displaying the screen.

• Local Action: Use an empty local action to end the transaction.


Use these methods to help prevent flow errors caused by governor limits !!

Service cloud omni-channel

 omni-channel channel types :


omni-channel is capable of working with two types of channels.

--> Real -Time Channels

--> Asynchronous Channels


Real - Time Channels :


Real-time Channels are channels where the person asking support is expecting a real-time answer to their request.


ex : Phone calls or live chat


Asynchronous Channels :


Asynchronous channels are channels where the person asking support is expecting a reply to their request at a later time.


ex : emails or contact forms


Omni-Channel Routing Destinations :


Omni-Channel can route Work Items to 3 different destinations.


1.Route to Queue


Work Items fall in a Queue of Users where Users are then picking up work first-in first-out.


2.Route to Skill


Work items are assigned to the Agents that have the proper Skills to work on the request.


3.Route to Agent 


work Items are assigned to a specific Agent directly.


Omni-Channel Agent Properties :


Agents have properties that Omni-Channel uses in order to select which agent is better suited to receive a work item based

on its Routing Destinations.


1.Status & Capacity :


Agents all have a Status, which models their availability,

and a Capacity, which models the maximum amount of work they can take.

ex : Statuses are : Away, Available,On Break etc

 

2.Skills :


Agents have a set of skills that they can leverage to take certain work Items.

Work Items can require one or multiple skills to be assigned. 

ex : Skills are : English, 2nd Tier,Robert Butler Maintenance etc


3.Queue Membership


Agents can e assigned to specific  queues,and thus work on work Items that fall in those Queues.

ex : Queues are : Billing,Complaint


Omni Supervisor :

Supervisors get access to the Omni Supervisor function in Omni-Channel in order to monitor their team easily.


1.Monitor Agents

2.Monitor Work Backlogs

3.Monitor Assigned Work


Monitor Agents :

Supervisors can monitor the Agents they have access to through the Supervisor Configuration assigned to them.

This include, the Agent status and status timeline, the Agent's Current work and open capacity, how long theyve been logged in etc.

Monitor Work Backlogs:

Supervisors can monitor specific skill & Queue backlogs to gauge how much work is left to be assigned to agents.

This allows them to have simple visibility on where to focus their efforts.

Monitor Assigned Work:

Supervisor can monitor work that's being worked on.

Using specific channel functionalities,they can even listen in on phone calls,

or see what agents are typing in the Chat even before they've sent it.

Wednesday, 25 December 2024

Different Git Commands

 𝟭. 𝗴𝗶𝘁 𝗱𝗶𝗳𝗳: Show file differences not yet staged.

𝟮. 𝗴𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 -𝗮 -𝗺 "𝗰𝗼𝗺𝗺𝗶𝘁 𝗺𝗲𝘀𝘀𝗮𝗴𝗲": Commit all tracked changes with a message.

𝟯. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘁𝘂𝘀: Show the state of your working directory.

𝟰. 𝗴𝗶𝘁 𝗮𝗱𝗱 𝗳𝗶𝗹𝗲_𝗽𝗮𝘁𝗵:Add file(s) to the staging area.

𝟱. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗰𝗸𝗼𝘂𝘁 -𝗯 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Create and switch to a new branch.

𝟲. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗰𝗸𝗼𝘂𝘁 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Switch to an existing branch.

𝟳. 𝗴𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 --𝗮𝗺𝗲𝗻𝗱:Modify the last commit.

𝟴. 𝗴𝗶𝘁 𝗽𝘂𝘀𝗵 𝗼𝗿𝗶𝗴𝗶𝗻 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Push a branch to a remote.

𝟵. 𝗴𝗶𝘁 𝗽𝘂𝗹𝗹: Fetch and merge remote changes.

𝟭𝟬. 𝗴𝗶𝘁 𝗿𝗲𝗯𝗮𝘀𝗲 -𝗶: Rebase interactively, rewrite commit history.

𝟭𝟭. 𝗴𝗶𝘁 𝗰𝗹𝗼𝗻𝗲: Create a local copy of a remote repo.

𝟭𝟮. 𝗴𝗶𝘁 𝗺𝗲𝗿𝗴𝗲: Merge branches together.

𝟭𝟯. 𝗴𝗶𝘁 𝗹𝗼𝗴 --𝘀𝘁𝗮𝘁: Show commit logs with stats.

𝟭𝟰. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘀𝗵: Stash changes for later.

𝟭𝟱. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘀𝗵 𝗽𝗼𝗽: Apply and remove stashed changes.

𝟭𝟲. 𝗴𝗶𝘁 𝘀𝗵𝗼𝘄 𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱: Show details about a commit.

𝟭𝟳. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁 𝗛𝗘𝗔𝗗~𝟭: Undo the last commit, preserving changes locally.

𝟭𝟴. 𝗴𝗶𝘁 𝗳𝗼𝗿𝗺𝗮𝘁-𝗽𝗮𝘁𝗰𝗵 -𝟭 𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱: Create a patch file for a specific commit.

𝟭𝟵. 𝗴𝗶𝘁 𝗮𝗽𝗽𝗹𝘆 𝗽𝗮𝘁𝗰𝗵_𝗳𝗶𝗹𝗲_𝗻𝗮𝗺𝗲: Apply changes from a patch file.

𝟮𝟬. 𝗴𝗶𝘁 𝗯𝗿𝗮𝗻𝗰𝗵 -𝗗 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Delete a branch forcefully.

𝟮𝟭. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁: Undo commits by moving branch reference.

𝟮𝟮. 𝗴𝗶𝘁 𝗿𝗲𝘃𝗲𝗿𝘁: Undo commits by creating a new commit.

𝟮𝟯. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗿𝗿𝘆-𝗽𝗶𝗰𝗸 𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱: Apply changes from a specific commit.

𝟮𝟰. 𝗴𝗶𝘁 𝗯𝗿𝗮𝗻𝗰𝗵: Lists branches.

𝟮𝟱. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁 --𝗵𝗮𝗿𝗱: Resets everything to a previous commit, erasing all uncommitted changes.

Different ways to validate and view data in Data cloud

 Data Explorer

Query Editor

Query API

Profile Explorer



Data Explorer :

The Data Explorer can only query a single data lake object or 

data model object and can only query up to 10 fields.


The Data Explorer can also only return up to 100 records.


Query Editor :


To get started with Query Editor you will first need to create a workspace. This workspace is a shared workspace that others can both view and use.


Query Editor can query across multiple data lake objects and data model objects and can return more fields and thousands of records.

You can also use SQL joins like inner joins and outer joins.


Note :

The timeout limit is five minutes so you will need to use some where clauses and limit clauses to filter down your records to make sure that your queries do not timeout.


Query Workspaces is a collaborative tool that allows you to query Data Model Objects, Data Lake Objects, Calculated Insights Objects, and Data Graphs.


Sunday, 8 December 2024

GraphQL

 Query language specification & runtime for APIs.

Single endpoint for all resources to be aggregated.

Efficient because only necessary data is requested.


TYPES :

Query : Entry point for read operations

Mutation : Entry point for create,update and delete.


EDGES :

Handles lists or relationships between nodes.

Links multiple nodes with info about the relationship.


NODES :

Individual data object or entity in schema.

Often encapsulate specific fields of the data.


ex :


query accounts {

  uiapi {

    query {

   Account {

     edges {

    node {

   Id

   Name {

      value

   }

}

   }

}

  

  }


}


Tuesday, 3 December 2024

JSON in Salesforce

 1.JSONGenerator :

Use this for manual control over JSON creation.

Perfect for building custom or dynamic JSON structures.


1.Need complete control over JSON Structure.

2.Add custom fields,logic or error handling.


2.JSON.serialize()

Quickly convert known objects or collections to JSON.

 e.g. Sending records to external system.

 

3.JSON.deserialize()

Automatically map JSON into salesforce objects.

 e.g. receiving data from APIs


4.JSON.deserializeUntyped()

Handle dynamic or unknown JSON structures by converting them into Apex Maps and Lists.


1.Unknown or dynamic JSON schemas.

2.JSON with extra or nested fields not directly tied to Salesforce objects.


5.JSONParser

Handle dynamic or unknown JSON structures by converting them into Apex Maps and Lists.


1.Need granular control over JSON parsing.

2.Working with complex or deeply nested JSON.


JSONGenerator                       : Custom JSON creation with full control

JSON.serialize()                      : Converting objects into JSON quickly, when structure matches the      object.

JSON.deserialize()                  : Converting JSON to salesforce objects easily

JSON.deserializeUntyped()     : Dynamic JSON structures with unknown fields or nested data

JSONParser                              : Fine-grained control for parsing JSON token by token.