0

I posted several FeedItems using Salesforce Rest API but the title attribute of <a> tags in rich texts were not working correctly for me.

For instance,

POST /sobjects/FeedItem/

{
    "ParentId": "5000o0000xxxxxxxxx",
    "Body": "<ol>\n    <li>\n        <a title=\"Google\" href=\"https:\/\/www.google.com\">Google<\/a>\n    <\/li>\n<\/ol>",
    "IsRichText": true
}
<ol>
    <li>
        <a title="Google" href="https://www.google.com">Google</a>
    </li>
</ol>

...would be parsed into

<ol>
    <li>
        <span dir="ltr" class="uiOutputText"></span>
        <a href="https://www.google.com" title="null" target="_blank"><span dir="ltr" class="uiOutputText">Google</span></a>
        <span dir="ltr" class="uiOutputText"></span>
    </li>
</ol>

...and displayed like

Salesforce Chatter comment screenshot

Any idea what's going wrong? Thanks.

0

As you may know salesforce provides 2 types of RTE (Rich Text Area) fields.

  1. Actually a RTE which has all the components such as adding hyperlink, images etc etc.

  2. Secondly, are those such as in feeditems which do not support the hyperlink, images etc things.

So, this is the reason why the hyperlink isn't showing in feeditems. Instead it's converted into span with target null.

Edit the feeditem you will see a different RTE field as compared to if you have any RTE Field on case or any other object.

Thanks!!!

  • The link is showing and works. Only the title is null. Please read my question carefully, thanks. – Frederick Zhang Feb 28 at 4:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.