3

I am trying to work on a task which will find all recent changes to any fields for an Opportunity within the system.

It looks as if Change Data Capture takes care of this, but I'm struggling to implement it.

Done so far

  • Added Opportunity to the Change Data Capture list in Setup
  • Made a change to an Opportunity

Problem

Now, I'm trying to call the API and find the change that I've made.

According to this page (Subscription Channels section), it seems like all changes will be found at /data/ChangeEvents, but the URL is not qualified, and there are no examples, so I don't know exactly where I should be directing the request.

What I've tried

http://{myentity}.salesforce.com/data/ChangeEvents http://{myentity}.salesforce.com/data/v47.0/ChangeEvents

Both gave URL No Longer Exists

http://{myentity}.salesforce.com/services/data/v47.0/ChangeEvents http://{myentity}.salesforce.com/services/data/ChangeEvents

both gave

    {
        "errorCode": "NOT_FOUND",
        "message": "The requested resource does not exist"
    }

myentity.../services/data/v47.0/tooling/sobjects/PlatformEventChannel

        "urls": {
            "rowTemplate": "/services/data/v47.0/tooling/sobjects/PlatformEventChannel/{ID}",
            "defaultValues": "/services/data/v47.0/tooling/sobjects/PlatformEventChannel/defaultValues?recordTypeId&fields",
            "describe": "/services/data/v47.0/tooling/sobjects/PlatformEventChannel/describe",
            "sobject": "/services/data/v47.0/tooling/sobjects/PlatformEventChannel"
        }
    },
    "recentItems": []

myentity.../services/data/v47.0/tooling/sobjects/PlatformEventChannelMember

        "urls": {
            "rowTemplate": "/services/data/v47.0/tooling/sobjects/PlatformEventChannelMember/{ID}",
            "defaultValues": "/services/data/v47.0/tooling/sobjects/PlatformEventChannelMember/defaultValues?recordTypeId&fields",
            "describe": "/services/data/v47.0/tooling/sobjects/PlatformEventChannelMember/describe",
            "sobject": "/services/data/v47.0/tooling/sobjects/PlatformEventChannelMember"
        }
    },
    "recentItems": []

I have been able to successfully retrieve and update data through the API, so I'm certain that there aren't any problems with authorisation or any other config

2 Answers 2

3

You're using the feature temporally backwards.

Now, I'm trying to call the API and find the change that I've made.

According to this page (Subscription Channels section), it seems like all changes will be found at /data/ChangeEvents, but the URL is not qualified, and there are no examples, so I don't know exactly where I should be directing the request.

Change Data Capture is intended for use with a subscription model. You, or your off-platform application, receive a stream of capture events that take place while you are subscribed and have an active connection to Change Data Capture. While you can use the replay capabilities of CDC to request the delivery of events that you missed while your subscription is offline, the intent is not that you should request change details on some cadence after the fact, and there's not an HTTP endpoint that you can hit to get a flat list of changes.

The Change Data Capture Developer Guide has code samples for how to subscribe using EMP Connector.

Your use case seems closer to the sObject Get Updated REST API endpoint.

1
  • Perfect, thank you! Clearly I was misunderstanding its intended use. "sObject Get Updated" does indeed look perfect for my use case.
    – Chris A
    Commented Dec 17, 2019 at 14:16
0

Based on the statement:

I am trying to work on a task which will find all recent changes to any fields for an Opportunity within the system.

If having change data capture running almost continually to detect the changes is overkill for the requirement you could also consider the more basic getUpdated() method that the SOAP API exposes.

You can make a single API call and find all the Opportunity records that were modified in a given time period.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .