function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sachin_KSachin_K 

chatter linkpost hide url

Am posting a feeditem of type linkpost to chatter using apex code. 

 

I want to show only the linkname and hide the linkurl.....

 

link to the image - 

Jia HuJia Hu

You can use TextPost instead of LinkPost, like

 

feeditem fi = new feeditem();
fi.body = 'I like www.google.com, how about u? ';
fi.parentid = '00510000000PBVl';
insert fi;

 

Only get the link once,...


Sachin_KSachin_K

hey Jia Hu thanks for the reply...u have given the absolute url so it takes it as a link but in my case the link points to a vf page...so i can give only the relative url ('apex/vf_page')

 

example feed in chatter box:

 

username : some text see details some text

 

when i click "see details" we should be able to open the vf page in a new window (width and height has to be specified) so that it looks like a popup window

 

please give some suggestions

Jia HuJia Hu

When you insert the post, you can use 

URL.getSalesforceBaseUrl().toExternalForm() + '\' + apex/vf_page

to turn the relative url into the real url .

 

Document is here:

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_url.htm


Sachin_KSachin_K

oh yeah..am able to get the base url :)

 

the thing is i want to display "see details" as the link text and link url should be vf page..

 

with ur suggestion am getting something like this in the chatter... 

 

username : test link https://na14.salesforce.com/apex/ExtendedProfile

 

but i want "see details" text in the place of "https://na14.salesforce.com/apex/ExtendedProfile"

 

that is like this  ---   username : see details 

 

and when  i click see details i should be goto https://na14.salesforce.com/apex/ExtendedProfile in a new window with height and width being specified..

Jia HuJia Hu

I got it, but it is difficult based on my understanding.

 

Maybe the Linkpost is not a bad choice.

 

However, if you would like to send the link to your users,

besides Chatter post,

you may consider the email, or the customer link on the Home tab,....