1

I've been working on getting updates from a custom object to generate a chatter post that has a reference to the custom object on a case. I have been able to get what I want in classic experience as I was able to open up another tab on the browser to the custom object but in lightning the same thing happens while I just want the tab to be opened inside the lightning window / same browser tab.

I have been the following anonymous apex to test creating these on cases:

ConnectApi.ChatterFeeds.postFeedElement(Network.getNetworkId(), 'caseIdHere', 
ConnectApi.FeedElementType.FeedItem, 
'I have completed the custom object ' 
+ String.valueOf(System.Url.getSalesforceBaseUrl()).substring(14,41) + '/' 
+ 'objectidhere');

FeedItem mypost1 = new FeedItem();
mypost1.LinkUrl = String.valueOf(System.Url.getSalesforceBaseUrl()).substring(14,41) +
'/' + 'relatedobjectidhere';
mypost1.ParentId = 'caseIdHere';
mypost1.body = 'The status on the following related object is \"completed\" : \r\n' + 
'<a href=\"javascript:srcUp(%27%2F<relatedobjectid>%3Fisdtp%3Dvw%27);">relatedobjectlink</a>';
insert mypost1;

FeedItem mypost2 = new FeedItem(); 
mypost2.LinkUrl = String.valueOf(System.Url.getSalesforceBaseUrl()).substring(14,41) +
'/' + 'relatedobjectidhere';
mypost2.ParentId = 'caseIdHere';
mypost2.body = 'The status on the following related object is \"completed\" : \r\n' + '<a href="/relatedobjectid">Link</a>';
insert mypost2;

Here is what that looks like: Case Chatter After Anonymous Apex Ran

All of the links I created from the anonymous apex create a new browser tab. I was wondering how I would get the same functionality as the button I have highlighted in the picture where clicking on it would open another tab inside the lightning window instead of another tab on the browser.

I have tried using mypost.richtext = true; but that disables the ability to use HTML markup, is there a way to put an anchor tag while setting this to true? That be great to be able to get the tab icon like the case icon I have highlighted too!

Thanks in advance.

1 Answer 1

1

Sadly, the feature I want doesn't look to be possible at the moment. Here are a few articles on it:

Look under "Chatter Publisher" here: chatter winter 16 release notes

Here's the idea in salesforce success: success idea

Thanks for anyone who looked into this.

You must log in to answer this question.

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