node.jssalesforcesoqlchange-data-capturejsforce

Salesforce API - Query of Change Data Capture's Selected Entities jsforce


Issue

I am trying to make a query to the Salesforce API to retrieve the "Selected Entities" that are listed under "Change Data Capture" using jsforce v1.11.1. The goal would be to query and pull a dynamic list of all Selected Entities in Change Data Capture from Salesforce.

When I make this SOQL query directly through the the Developer Console it retrieves all of the desired information.

SELECT Id,DeveloperName,EventChannel,SelectedEntity FROM PlatformEventChannelMember

Then when I run this same query using jsforce I get an error saying:

INVALID_TYPE: sObject type 'PlatformEventChannelMember' is not supported.

const res = await conn.tooling.query('SELECT Id,DeveloperName,EventChannel,SelectedEntity FROM PlatformEventChannelMember') 

What I have tried

  1. Triple checked that I have the correct permissions to make the query.

  2. Tried variations of the query with and with out tooling.

    conn.query('SELECT Id,DeveloperName,EventChannel,SelectedEntity FROM PlatformEventChannelMember')
    
  3. Used different methods to retrieve the data.

    conn.tooling.request('/services/data/v61.0/tooling/sobjects/PlatformEventChannelMember')
    
  4. Tried the Metadata API.

    I am open to any suggestions. Feel like I am close but can't seem to get it.


Solution

  • I have found the solution to the issue with some helpful suggestions from @eyescream. By looking in Salesforce->Setup->Login History I was able to see the version of the API being sent to Salesforce, it was v42 while latest is v61. When I reinstalled the correct version of jsforce everything works as expected. jsforce v3.2.3 is using v50.

    jsforce had v1.11.1 listed as the latest version on NPM. That was updated to be v3.2.3 yesterday and an npm install jsforce will now give you v3.