Friday, February 7, 2025

Salesforce Integration Interview Questions Platform Event Limits Part-7

1) What is the High-Volume Platform Event Hourly Publishing Allocation?

It specifies the maximum number of platform events that can be published in one hour. The limit is 250,000 events per hour for Performance and Unlimited Editions.

2) What is the High-Volume Platform Event and Change Event Daily Delivery Allocation?

It defines the total number of platform and change events that can be delivered to subscribers in a 24-hour period. The limit is 50,000 deliveries per day for Performance and Unlimited Editions.

3) What publishing methods count toward the hourly publishing limit?

Publishing methods include:

  • Apex
  • Pub/Sub API
  • REST API
  • SOAP API
  • Bulk API
  • Flows
  • Process Builder processes
4) Which delivery methods count toward the daily delivery limit?

Delivery methods include:

  • Pub/Sub API
  • CometD
  • empApi Lightning component
  • Event relays
5) Which actions are excluded from the daily delivery allocation?

The following actions don’t count toward the delivery limit:

  • Apex triggers
  • Flows
  • Process Builder processes
6) How is the hourly publishing usage calculated?

Each published event counts as one unit against the hourly publishing limit, regardless of the publishing method. For example, publishing 1,000 events in an hour counts as 1,000 against the limit.

7) How is the daily delivery usage calculated?

Each event delivered to a subscriber is counted separately. For instance: Publishing 1,000 events to 10 subscribers counts as 10,000 deliveries (1,000 × 10).

8) What happens if you exceed the hourly publishing limit?

Events published beyond the limit will fail. Organizations must monitor and optimize their event publishing to stay within the allowed limits.

9) What is the purpose of the Platform Event Add-On License?

The add-on increases event delivery and publishing limits, providing flexibility during usage spikes. It enables organizations to handle higher volumes of platform event usage.

10) What are the primary benefits of the add-on license?
  • Increased Daily Delivery Allocation: Adds 100,000 events per day (3 million per month).
  • Enhanced Hourly Publishing Allocation: Adds 25,000 events per hour.
  • Flexibility for Usage Spikes: Allows for temporary exceedance of daily delivery limits.
11) How does the add-on affect daily event delivery limits?

With the add-on:

  • The daily delivery allocation increases to 150,000 events (50,000 included + 100,000 from the add-on).
  • The monthly entitlement reaches 3 million events.
12) How does the add-on affect hourly publishing limits?

It increases the hourly publishing limit by 25,000 events, resulting in a total of 275,000 events per hour for Performance and Unlimited Editions.

13) What steps should an organization take to maximize its event delivery capabilities?

  • Monitor and optimize event usage.
  • Purchase the add-on license if higher limits are required.
  • Contact Salesforce for guidance on best practices.

Gain a deep understanding of Salesforce integration, from creating and configuring Connected Apps to mastering advanced topics like OAuth flows, SAML-based Single Sign-On, and Streaming APIs. Our PDF course combines practical examples, real-time scenarios, and integration patterns to equip professionals with the skills needed to streamline processes and enhance productivity. Tailored for those with 2–8 years of experience, it’s your guide to unlocking seamless connectivity between Salesforce and other systems.

Link to course : Mastering Salesforce Integration

Saturday, February 1, 2025

Salesforce Integration Interview Questions Change Data Capture Part-6

 1) What is Change Data Capture (CDC)?

Change Data Capture is a streaming product in Salesforce that enables real-time integration with external systems. It notifies subscribed systems of data changes like record creation, updates, deletions, and undeletions, helping keep external systems in sync without periodic data exports or repeated API calls.

2) What types of objects support CDC?

CDC is available for all custom objects and a subset of standard objects. Each object has an associated ChangeEvent object, named <ObjectName>ChangeEvent for standard objects and <ObjectName>__ChangeEvent for custom objects.

3) Can CDC events be queried or modified?

No, ChangeEvent objects don’t support CRUD operations or queries. They are used to capture and publish changes but cannot be directly manipulated.

4) How does CDC handle security for fields in change events?

CDC respects field-level security, delivering only the fields a user has access to. However, it ignores record-level sharing settings and doesn’t include derived fields (e.g., formula fields) except for roll-up summary fields.

5) What fields are excluded in CDC event messages?

Excluded fields include:

  • IsDeleted
  • SystemModStamp
  • Formulae Fields (except roll-up summary fields).

6) What are the steps to enable Change Data Capture?

  1. Navigate to Setup > Change Data Capture in Salesforce.
  2. Select the desired custom and standard objects from the Available Entities list.
  3. You can enable up to five entities by default. For more, purchase an add-on license.
  4. Save the settings.

7) Provide an example of subscribing to CDC events using the Workbench.

  1. Open Workbench > Queries > Streaming Push Topics.
  2. Click Generic Subscriptions and enter /Data/AccountChangeEvent.
  3. Click Subscribe to establish the connection.

Updates to the Account record will trigger notifications visible in the Workbench.

8) What happens if you need different subscribers to receive specific event types?

Use custom channels to group and isolate change events for different subscribers. This ensures that each subscriber receives only the events they need.

9) What are the licensing constraints for CDC?

  • Default: Up to 5 entities.
  • Add-on license: Select up to 10 entities per channel and increase delivery allocations. After selecting the first 10 entities, you can add more.

Gain a deep understanding of Salesforce integration, from creating and configuring Connected Apps to mastering advanced topics like OAuth flows, SAML-based Single Sign-On, and Streaming APIs. Our PDF course combines practical examples, real-time scenarios, and integration patterns to equip professionals with the skills needed to streamline processes and enhance productivity. Tailored for those with 2–8 years of experience, it’s your guide to unlocking seamless connectivity between Salesforce and other systems.

Link to course : Mastering Salesforce Integration

Friday, January 24, 2025

Salesforce Integration Interview Questions Platform Event Part-5

 1) How can you publish a platform event using Apex?

You can publish a platform event using the EventBus.publish() method in Apex. Here's how:

  • Create an instance of the platform event object and populate its fields.
  • Use EventBus.publish() to publish the event, which returns a Database.SaveResult.
  • Check isSuccess() on the result to determine whether the event was published successfully.
TestEvent__e event = new TestEvent__e(
    Customer_Country__c = 'India',
    Customer_State__c = 'Maharashtra',
    Government_Customer__c = true
);
Database.SaveResult result = EventBus.publish(event);
if (result.isSuccess()) {
    System.debug('Platform event published successfully.');
} else {
    for (Database.Error error : result.getErrors()) {
        System.debug('Error: ' + error.getMessage());
    }
}

2) What is the difference between ReplayId and EventUuid in platform events?

  • ReplayId: A system-assigned field that identifies the position of an event in the event stream. It isn’t guaranteed to be unique, especially during Salesforce maintenance activities.
  • EventUuid: A universally unique identifier (UUID) introduced in API version 52.0 and later. It is always unique and should be used to identify a platform event message.

  • Example of Retrieving EventUuid:

    Database.SaveResult result = EventBus.publish(event);
    if (result.isSuccess()) {
        System.debug('UUID=' + EventBus.getOperationId(result));
    }

    Using EventUuid ensures the identification of an event message across different scenarios, including maintenance activities.

    3) What are the Apex governor limits for platform event triggers?

    Although platform event triggers run asynchronously, the synchronous limits apply to platform event triggers. This is because Asynchronous limits are for long-lived processes, such as Batch Apex and future methods. Synchronous limits are for short-lived processes that execute quickly and platform event triggers are short-lived processes that execute in batches rather quickly.

    Because a platform event trigger runs in a separate transaction from the one that fired it, governor limits are reset, and the trigger gets its own set of limits.

    4) How can you configure the user and batch size for a platform event trigger?

    You can override the default running user and batch size of a platform event trigger using PlatformEventSubscriberConfig via Tooling API or Metadata API.
    • Default Configuration: Runs as the Automated Process user with a batch size of 2,000.
    • Custom Configuration: Specify a custom user and a batch size between 1 and 2,000. Smaller batch sizes help avoid hitting governor limits.
    5) How to create and manipulate PlatformEventSubscriberConfig?

    We can create PlatformEventSubscriberConfig from workbench as shown below. To add a configuration, perform a POST request to this endpoint.

    Salesforce Integration Interview Questions Platform Event


    Also, you can query retrieve the configurations in your org with SOQL. If querying from the Developer Console Query Editor, ensure you select Use Tooling API. This example query retrieves all configurations set up in your Salesforce org.

    SELECT Id,DeveloperName,BatchSize,PlatformEventConsumerId,UserId FROM PlatformEventSubscriberConfig

    To get or manipulate a configuration, use this endpoint with the ID of your PlatformEventSubscriberConfig record appended.

    /services/data/v60.0/tooling/sobjects/PlatformEventSubscriberConfig/<ID>

    You can also,

    ·         Delete a specific configuration with a DELETE request.

    ·         Update a specific configuration with a PATCH request. For this request, include the PlatformEventSubscriberConfig definition in the request body.

    6How do you subscribe to platform events using CometD?

    To subscribe to platform events, use the channel name /event/Event_Name__e in a CometD client. For example, to subscribe to a TestEvent__e platform event, use the channel /event/TestEvent__e. The CometD client receives real-time event notifications in JSON format.

    7) How can you encrypt platform event messages in the event bus?

    To encrypt platform event messages:

    1. Create an event bus tenant secret in the Key Management page in Setup.
    2. Enable encryption for platform events on the Encryption Policy page.
      Without Shield Encryption, messages are stored in clear text in the event bus.
    8) How can you monitor platform event usage?

    Use the PlatformEventUsageMetric object to monitor event publishing and delivery usage. Example queries:

    To retrieve the usage of platform events:

    Events Delivered (April 26, 2024, 11:00 to April 27, 2024, 11:00):

    SELECT Name, StartDate, EndDate, Value 

    FROM PlatformEventUsageMetric 

    WHERE Name='PLATFORM_EVENTS_DELIVERED' 

    AND StartDate=2024-04-26T11:00:00.000Z 

    AND EndDate=2024-04-27T11:00:00.000Z

    Events Published (April 26, 2024, 11:00 to April 27, 2024, 11:00):

    SELECT Name, StartDate, EndDate, Value 
    FROM PlatformEventUsageMetric 
    WHERE Name='PLATFORM_EVENTS_PUBLISHED' 
    AND StartDate=2024-04-26T11:00:00.000Z 
    AND EndDate=2024-04-27T11:00:00.000Z

    Publishing Methods: Apex, APIs (Pub/Sub API), Flows, and Process Builder.

    Subscription Methods: CometD, Pub/Sub API, empApi Lightning components, and event relays.

    Note: Delivery metrics exclude event deliveries to Apex triggers, flows, and processes.

    Gain a deep understanding of Salesforce integration, from creating and configuring Connected Apps to mastering advanced topics like OAuth flows, SAML-based Single Sign-On, and Streaming APIs. Our PDF course combines practical examples, real-time scenarios, and integration patterns to equip professionals with the skills needed to streamline processes and enhance productivity. Tailored for those with 2–8 years of experience, it’s your guide to unlocking seamless connectivity between Salesforce and other systems.

    Link to course : Mastering Salesforce Integration

    Friday, January 17, 2025

    Salesforce Integration Interview Questions Platform Event Part-4

    1) What is the purpose of Salesforce Streaming API?

    The Salesforce Streaming API enables real-time data updates using push technology and an event-driven architecture. It operates on an event-based model, allowing applications to subscribe to events and receive updates as they occur in near real-time.

    2) What types of events are supported by the Salesforce Streaming API, and in which scenarios should it be used?

    Types of Events Supported:

    1. Generic Events: Legacy, for custom notifications.
    2. PushTopics: Legacy, for changes in Salesforce records based on SOQL queries.
    3. Change Data Capture (CDC): For tracking changes to Salesforce data records in real-time.
    4. Platform Events: For high-volume, custom business event notifications.

    When to Use the Streaming API:
    Use Streaming API when real-time data updates are required to synchronize external systems with Salesforce data, such as in applications that react immediately to changes in data or business processes.

    Note: PushTopics and generic events are legacy products with limited support. For new implementations, use Change Data Capture instead of PushTopics and Platform Events instead of generic events.

    3) What are platform events in Salesforce?

    Platform events are secure and scalable messages used to enable real-time communication between Salesforce and external apps, as well as within Salesforce itself, using an event-driven messaging architecture.

    4) What is the Event Bus in Salesforce?

    The event bus is a temporary storage system where platform event messages are published. Events on the bus can be retrieved using a CometD client, and each event contains a ReplayId field to identify its position in the stream.

    5) What are standard platform events, and how can they be used?

    Standard platform events, such as AssetTokenEvent and BatchApexErrorEvent, are predefined by Salesforce for specific purposes like monitoring authentication or reporting errors. Custom platform events can also be defined and published using Apex, Process Builder, Flow Builder, or APIs, and subscribed to via triggers or external apps.

    6) How are platform events published in Salesforce?

    Platform events can be published:

    • Immediately: Messages are sent as soon as they are generated and cannot be rolled back.
    • After Commit: Messages are sent only after a transaction is committed, and they support rollback using setSavepoint() and rollback().

    7) What are high-volume platform events, and how are they different from standard-volume events?

    High-volume platform events, introduced in API version 45.0, allow for better scalability and can handle millions of events. They are always published asynchronously for efficient processing. Standard-volume events are no longer available for new definitions but are supported for existing implementations.

    8) What is the retention period for platform event messages on the event bus?

    • High-Volume Events: Retained for 72 hours (3 days).
    • Standard-Volume Events: Retained for 24 hours (1 day).

    9) What is the ReplayId field in platform event messages?

    The ReplayId field is a system-generated, opaque identifier for an event in the stream. It helps subscribers retrieve missed events during resubscription within the retention window. Replay IDs are not guaranteed to be unique.

    Gain a deep understanding of Salesforce integration, from creating and configuring Connected Apps to mastering advanced topics like OAuth flows, SAML-based Single Sign-On, and Streaming APIs. Our PDF course combines practical examples, real-time scenarios, and integration patterns to equip professionals with the skills needed to streamline processes and enhance productivity. Tailored for those with 2–8 years of experience, it’s your guide to unlocking seamless connectivity between Salesforce and other systems.

    Link to course : Mastering Salesforce Integration

    Friday, January 10, 2025

    Salesforce Integration Interview Questions and Answers Part-3

     1) What are the key steps involved in any OAuth authorization flow?

    OAuth flows typically involve three main steps:

    1. Access Request: The client app requests access to a protected resource.
    2. Token Issuance: The authorization server grants an access token to the client app.
    3. Token Validation: The resource server validates the access token and allows access to the protected resource.
    2) How does the OAuth 2.0 Client Credentials Flow differ from the Username-Password Flow?

    OAuth 2.0 Client Credentials Flow:

    • Used for server-to-server integrations without user interaction.
    • The client app exchanges its consumer key and consumer secret for an access token.
    • More secure and avoids transmitting user credentials.

    OAuth 2.0 Username-Password Flow:

    • Authorizes a client app using stored user credentials.
    • Not recommended due to security risks, as it transmits user credentials back and forth.
    • Suitable only in special cases with a high degree of trust.
    3) What makes the OAuth 2.0 JWT Bearer Flow secure, and when should it be used?

    Security Features:

    • Uses a JSON Web Token (JWT) signed with a certificate, ensuring data integrity and authenticity.
    • Eliminates the need to transmit sensitive user credentials or rely on interactive logins.
    • Requires prior approval of the connected app, adding an additional layer of control.

    Use Case:

    • Ideal for server-to-server integrations where ongoing access to Salesforce resources is needed without user interaction.
    4) Why is the Username-Password Flow not recommended, and what are its key steps?

    The Username-Password Flow is not recommended because it involves passing sensitive user credentials (username and password) back and forth, which can lead to security vulnerabilities, especially if the credentials are intercepted.

    Key Steps:

    1. The connected app sends a POST request to the Salesforce token endpoint with the user's credentials and app details (client ID, client secret, username, and password).
    2. Salesforce verifies the request and grants an access token to the connected app.
    3. The connected app uses the access token to access protected resources in Salesforce.

    Example Usage:


    A request to generate an access token includes:

    grant_type=password&

    client_id=<Connected_App_Consumer_Key>&

    client_secret=<Connected_App_Consumer_Secret>&

    username=<User_Username>&

    password=<User_Password>

    When to Use:

    • Suitable only for scenarios with a high level of trust between the client and resource owner.
    • Should only be used as a last resort, with minimal permissions and strong security measures.
    5) How can you integrate two Salesforce orgs using the Username-Password Flow, and what are the main steps involved?

    The integration of two Salesforce orgs using the Username-Password Flow involves securely fetching data from one org (ORG B) and displaying it in another org (ORG A). This method leverages OAuth 2.0 for authentication and the Salesforce REST API for data retrieval.

    Key Steps in Integration:

    In ORG B:

    • Create a Connected App to allow authentication.
    • Implement a RESTful Web Service to fetch data.

    In ORG A:
    • Configure a Remote Site Setting to allow outbound calls to ORG B.
    • Create an Apex Controller to:
              a) Authenticate with ORG B using the Username-Password Flow.

    The Apex controller sends a POST request to ORG B's token endpoint using the credentials and client information from the connected app.

              b) Call the web service in ORG B to fetch the required data.

    Once authenticated, the controller sends an HTTP GET request to the web service in ORG B, providing query parameters.

  • Develop a Visualforce Page or LWC to display the retrieved information. 

  • 6) How would you integrate two Salesforce orgs (ORG A and ORG B) using the Client Credentials Flow?

    To integrate two Salesforce orgs using the Client Credentials Flow, follow these high-level steps:

    Setup in ORG B:
    • Create a Connected App in ORG B, enabling the Client Credentials Flow to allow secure server-to-server communication.
    • Note the Consumer Key and Consumer Secret, which will be used by ORG A to authenticate.
    • Implement a web service in ORG B to handle incoming requests for data creation or updates.
    Setup in ORG A:
    • Configure Custom Metadata or a secure storage mechanism to store the Consumer Key, Consumer Secret, and ORG B’s endpoint.
    • Create Remote Site Settings in ORG A for ORG B’s API endpoint to allow external callouts.
    • Develop an Apex class in ORG A to:
                   a) Authenticate with ORG B using the Client Credentials Flow and retrieve an access token.
                  b) Once Authenticated, Perform API callouts to ORG B’s web service to send or retrieve data as required.

    Trigger Integration:
    • Implement triggers or scheduled processes in ORG A to identify when data should be synchronized with ORG B based on business rules.
    • Ensure error handling and logging mechanisms are in place for monitoring and troubleshooting.

    This approach enables secure and efficient integration between the two Salesforce orgs, leveraging the Client Credentials Flow for authentication.

     7) What is the OAuth 2.0 JWT Bearer flow, and how does it enable server-to-server integration?

    The OAuth 2.0 JWT Bearer flow is a method for enabling secure, server-to-server integration without requiring user interaction for each request. It allows a client (server) to authenticate with another server (e.g., Salesforce) by sending a digitally signed JSON Web Token (JWT) to obtain an access token.

    How It Works:

    1. Create a JWT: The client generates a JWT signed with its private key. This JWT includes claims like iss (issuer/client ID), sub (subject/user), aud (audience), and exp (expiration time).
    2. Request Access Token: The client sends the signed JWT to the OAuth token endpoint, specifying the grant type as urn:ietf:params:oauth:grant-type:jwt-bearer.
    3. Salesforce Grants Access Token: Salesforce verifies the JWT signature using the public key from the connected app's certificate. Upon successful verification, it issues an access token.
    4. Access Protected Data: The client uses the access token in API requests to securely access Salesforce resources.

    This flow is especially useful for system-to-system communication where user intervention is impractical or unnecessary.

    8) What is the difference between a self-signed certificate and a CA-signed certificate?

    The main difference lies in the issuer of the certificate:

    • Self-Signed Certificate: Created, signed, and issued by the entity it is intended for. It does not involve any external validation.
    • CA-Signed Certificate: Created, signed, and issued by a trusted third-party Certificate Authority (CA), which verifies the identity of the applicant.

    Key Consideration: CA-signed certificates are more widely trusted but come with a cost, while self-signed certificates are free but may not be trusted by external systems.

    Gain a deep understanding of Salesforce integration, from creating and configuring Connected Apps to mastering advanced topics like OAuth flows, SAML-based Single Sign-On, and Streaming APIs. Our PDF course combines practical examples, real-time scenarios, and integration patterns to equip professionals with the skills needed to streamline processes and enhance productivity. Tailored for those with 2–8 years of experience, it’s your guide to unlocking seamless connectivity between Salesforce and other systems.

    Link to course : Mastering Salesforce Integration