One customer to whom we implemented Salesforce-to-Salesforce few years ago contacted us after the upgrade to Winter ’16. Everything worked without any problems till the time the client requested to sync some chatter message for the synchronised record. Of course, it was challenge for us because we have developed functionality for sync chatter from one Salesforce org to another for the first time. But we managed it successfully and synchronisation is still working without any problem.

The customer received the following error message:

400 Bad Request [{“errorCode”:”JSON_PARSER_ERROR”,”message”:”Unrecognized character escape ‘x’ (code 120) at [line:1, column:75]”}]

We tried to post some messages but error remained still the same. It was really a special case because there was no ‘x’ in the message that made us feel a little bit confused, so we started debug it and here is the result:

{

“body”: {

    “messageSegments”: [

        {

            “type”: “text”,

            “text”: ” \x3cp\x3etest message\x3c\/p\x3e”

        }

    ]

}

}

There were new characters ‘\x3cp\x3e’ and ‘\x3c\/p\x3e’ added by Salesforce that correspond to HTML codes <p> and </p> in hexa ascii code.  Simply explained, Salesforce started to save chatter message in the HTML code, not a plain text as previously.

Firstly we turned off this feature immediately in order to influence the next messages.

Go to: Setup->Customize->Chatter->Chatter setting

Uncheck ‘Allow users to compose rich text posts’ and save changes.

For this time, chatter messages have been saved in the plain text model and developers have some time to fix this in sandbox and deploy changes into production.

Article written by Maroš Sitko, Senior Developer