I have a requirement to add a link from one case to another within the case feed. This will happen from a future method called from trigger context, so it should be bulk safe. For this reason, I'd like to insert
FeedItem records directly instead of using
I've tried a few things with partial success:
- I tried to insert a
IsRichTextset to true, with an embedded
<a>tag pointing to the url
'/' + caseId. This gave an error that the link must begin with 'http:', 'https:', etc.
- I changed the link to
'sfdc:' + caseId(the form required for
img srcattributes when using RichText), but got the same error.
- I changed the link to a full SFDC url (
URL.getSalesforceBaseUrl().toExternalForm() + '/' + caseId), which generated the error, "Context user does not have permission to create rich text in feed." I can find no documentation of this error, but I have seen claims that you can only insert a RichText TextItem via SOAP API.
- I switched to creating a
LinkPost. Again, I had to use a full URL. This works, but the link opens in a new browser tab instead of within a new Console tab.
This last will work if no other choice, but I'd really prefer a way to show a link to the other case that would open the other case directly in the current Console. I don't particularly care what FeedItem type I use. Is this possible?