Monday, June 10, 2024

Pulling data in from external systems using DataLicense

 One of the mechanisms to pull data in from other systems is to go for a Product called Salesforce Data Pipeline. It is its own SKU so you need to review licensing requirements with your CSM.


It's a simple tool to connect to any external Data Store and pull data in using the Analytics Data Manager. YOu need to create a recipe to pull data in. It's super easy and lot convenient if you have many needs to get data from external systems.


You can pull data in and store it in a Staging table and process it from there. 

Friday, March 4, 2022

 All about Platform Events

Platform Events are used to deliver secure, scalable, and customizable notification within Salesforce or external app. Platform Event is based on Event-Driven Architecture. This is built in real time integration patterns in the Salesforce Platform which helps to reduce point-to-point integration.

Publishing platform event: 

We can publish the platform events in 3 ways:

  1. Publish Events Messaging using APEX.
  2. Publish Events Messaging using Declarative tools (Process Builder or Cloud Flow Designer Tool / Visual Work flow).
  3. Publish Events Messaging using Salesforce API from external app.

Not supported in Platform event: 

  1. The allOrNoneHeader API header is ignored when you publish platform events through the API.
  2. The Apex setSavepoint() and rollback() Database methods aren’t supported with platform events.

Subscription in Platform Event: 

  1. Apex triggers receive event notifications.
  2. write an “after insert” Apex trigger on the event object to subscribe to incoming events.
  3. Triggers receive event notifications from various sources—whether they’re published through Apex or APIs.
  4. Visualforce and Lightning component apps receive events through CometD.
  5. CometD is a scalable HTTP-based event routing bus that uses an AJAX push technology pattern known as Comet.
  6. In an external app, you subscribe to events using CometD as well.

Defining Objects and fields in Platform Events: 

Platform events can be created just like the custom objects. The biggest difference between Platform events and Custom object is suffix name for the api name. In Platform events, its api name suffix with __e where the custom object appends __c suffix to create api name. Unlike with custom objects, we cannot update or delete event record, or view event records in Salesforce User Interface.

Platform Events support only following custom fields type,

  1. Checkbox
  2. Date
  3. Data/Time
  4. Number
  5. Text
  6. Text Area (Long)

Tuesday, March 1, 2022

 All about Outbound Messaging


Pros

  • Outbound Message has in-built retry mechanism. 
  • Messages will be queued locally. A separate background process performs the actual sending, to preserve message reliability
  • If the endpoint is unavailable, messages will stay in the queue until sent successfully, or until they are 24 hours old. After 24 hours, messages are dropped from the queue.
  • If a message cannot be delivered, the interval between retries increases exponentially, up to a maximum of two hours between retries.
  • Messages are retried independent of their order in the queue. This may result in messages being delivered out of order.
  • Source object may change after a notification is queued but before it is sent, so the endpoint will only receive the latest data, not any intermediate changes. Because a message may be delivered more than once, your listener client should check the notification IDs delivered in the notification before processing.
Security Considerations
  • All Outbound messages are sent from Salesforce IP address. Make sure that Salesforce IP addresses are white listed in external system.
  • Using SSL/TLS provides confidentiality while data is transported across the internet.
  • You can pass user session Id in outbound messages so that external system can callback and update data back in salesforce.
  • The organization Id is included in each message. Your client application should validate that messages contain your organization Id.
If your application (endpoint) server's SSL/TLS may be configured to require client certificates (two-way SSL/TLS), in order to validate the identity of the Salesforce server when it takes the role of client to your server. If this is the case, you can download the Salesforce client certificate from the Salesforce application user interface. This is the client certificate that Salesforce sends with each outbound message for authentication.
  • From Setup, enter API in the Quick Find box, then select API.
  • On the API WSDL page, click Manage API Client Certificate.
  • On the Certificate and Key Management page, in the API Client Certificate section, click the API Client Certificate.
  • On the Certificates page, click Download Certificate. The .crt file is saved in the download location specified in your browser.
Import the downloaded certificate into your application server, and configure your application server to request the client certificate. The application server then checks that the certificate used in the SSL/TLS handshake matches the one you downloaded.

Tuesday, June 29, 2021

DevConsole NonFunctional

 From time to time; if you are a DevConsole user the devconsole becomes console, in my case a "Communication Failure" was being returned.


Well. to restore your DevConsole

Developer Console menu may become non-functional sometimes, because of the workspace being in a bad state. To restore the functionality, follow the following steps. Fix 1: 1. Login and open Developer Console by Chrome 2. Open Developer tools and select Network 3. Reload on Developer Console Fix 2: 1. Login to Workbench and go to REST Explorer 2. Use the following query in Workbench to get the IDEWorkspace /services/data/v31.0/tooling/query/?q=SELECT id, name from IDEWorkspace ID of IDEWorkspace is "1dexxxxxxxxxxxxxx". 3. Do GET operation for the found id with following query "/services/data/v29.0/tooling/sobjects/IDEWorkspace/1de1a0000014sEWAAY" 4. You will see the content of IDEWorkspace 5. Do DELETE operation on found record. 6. Re-open Developer Console. 7. Developer Console will work fine. As we created a new workspace and the old workspace has been deleted. And the slowness will also be removed. I also had multiple WorkSpaces

Wednesday, March 25, 2020

Failed: InvalidBatch : Failed to process query: FUNCTIONALITY_NOT_ENABLED: Selecting compound data not supported in Bulk Query

Recently, while trying to extract data from WorkBench, I ran into this error.

I had selected all the fields on the Lead object and the error was not obvious enough for me

Failed: InvalidBatch : Failed to process query: FUNCTIONALITY_NOT_ENABLED: Selecting compound data not supported in Bulk Query


After some trial and error what I found is you need to elliminate compond fields from your BulkAPI query like Addresss.

Once I eliminated Address as a field from the file, I was able to extract the file successfully.

Thursday, December 19, 2019

Architect: Investigating Static Resources

Per Org, Salesforce allocates upto 250MB storage space. If you happen to run into a situation where you want to find how much storage space is being used then you could use the following 2 queries
and take action appropriately.

Following 
select id,bodylength,cachecontrol,contenttype,createdby.alias,createddate,description, lastmodifieddate from staticresource
will give you a list of all the static resources and the space it consumes

and the 
select sum(bodylength) from staticresource gives you the total storage space consumed

You might run into this issue if you have many installed packages in your system or you are using 3rd party tools like Skuid which masks Salesforce UI but allowing you to use custom UI but in the form of static resources

Enjoy !!!

Tuesday, October 8, 2019

Deleting Debug logs

If you have had to take over a system with little to KT and you have been running debug logs then you can attest to the pain points of deleting the logs by clicking Delete All..

There is a way out using Tooling API.

Delete logs are found from workBench using the following query

SELECT Id, StartTime, LogUserId, LogLength, Location FROM ApexLog

  1. Open Developer Console.
  2. At the bottom of the console, select the Query Editor tab.
  3. Select Use Tooling API.
  4. Enter this SOQL query:
    SELECT Id, StartTime, LogUserId, LogLength, Location FROM ApexLog
  5. Click Execute.
  6. Select the logs you want to delete. To sort by a column, click its header. To select individual logs, press Ctrl (Windows or Linux) or Command (macOS). To select a block of logs, press Shift.