2

Salesforce has a setting called 'Disable Feed Tracking' a.k.a. DisableFeedTrackingHeader. The Data Loader uses this setting to disable feed tracking when doing updates/inserts.

I am using Microsoft DataFactory to send updates to Salesforce. It seems like this tool also disables feed tracking, though I cannot find any evidence in documentation. But its behavior is remarkably similar to that of Data Loader. And just as in Data Loader, there is no setting to influence this behavior.

Flows and Apex triggers that are activated because records were updated, seem to inherit the 'Disable Feed Tracking' setting from whatever caused the updates. I have been able to simulate this using Developer Workbench (where you can change the setting).

However, what I would like is to enable a flow or Apex trigger to override this setting. I want to have the same feed items as I see when I change a record manually.

How to do this? I would prefer a flow solution, but Apex is fine as well. As long as I can get it to work.

One of the possible workarounds is to create Chatter posts via the flow, but that turns out to be not really viable, because we have a multi-language org and it is not possible to create Chatter posts that appears in different languages to different users.

2 Answers 2

0

Before shifting the solution into Salesforce, have you tried support with Microsoft Azure regarding the connector itself for the DisableFeedTrackingHeader SOAP header property? Maybe it's possible to adjust it in the connector (in a very much hidden place). I was going through the documentation and some forums and also found nothing relevant, but it's worth the ask.

When it comes to an alternative, it can be done via Flow or Apex, with the remarks:

  • Consider proper protection for the execution - e.g. only run this for the integration user associated with DataFactory.
  • You can either "hardcode" the fields you want to evaluate, replicating the Feed Tracking check (easy but not scalable: if the feed tracking changes, you'll need to update the code), or retrieve in the transaction which fields are tracked (a bit more tricky and computationally heavy)

You can find a couple of examples via apex here.

0

My current workaround is ugly, but it gets the job done and the Chatter feed ends up looking like what it should look like. The end justifies the means so to say. I'll leave it in place until I find a decent solution.

What I want is the Chatter feed to show field updates, say for fields A, B and C. Instead of having DataFactory send values for these fields, I am sending a new field, FieldChanges. This contains something like: A:1|B:pqr|C:xyz.

I have created an Apex job that runs periodically and translates anything in FieldChanges into the real changes to A, B and C. An asynchronous job is sufficient here. It is not important that the changes in A, B and C are in real-time (the DataFactory job runs only once a day, so the Apex job can run just after that).

The end result is that all relevant field changes show up in the Chatter feed, in the end user's language. But I am the first to admit that this is not the most efficient or elegant solution.

Some code for inspiration (not complete, just the relevant part):

for (String fieldChange : a.FieldChanges__c.split('\\' + CHANGE_SEP)) {
    String fieldName = fieldChange.left(fieldChange.indexOf(VALUE_SEP));
    if ((fieldName == null) || (fieldName == '') || PERMITTED_FIELDS.indexOf(fieldName) < 0) {
        throw new ProcessException('Error: invalid fieldname: <' + fieldName + '>');
    }
    String newValue = fieldChange.substringAfter(VALUE_SEP);
    if ((newValue == '') || (newValue == 'null')) {
        newValue = null;
    }
    if (a.get(fieldName) != newValue) {
        a.put(fieldName, newValue);
        hasBeenUpdated = true;
    }
}

You must log in to answer this question.

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