• Raviraj S 1
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I want to add image in chatter post. I am trying the below example but the ContentData and ContentFileName fields are not present in FeedItem. API version 39.0. I also got similar post but I am facing the same issue.

Blob body=[Select Name, ContentType, Body From StaticResource where name='abc'].body;
FeedItem post = new FeedItem();
post.ParentId = u.id;
post.CreatedById='005E0000003XWRs';
post.Body ='Happy birthday '+u.name;
post.ContentData = body;
post.ContentFileName = 'sample.png';
insert post;

I also tried with below code, but here img tag is not working. it throws error as :- Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Referenced file id is invalid, not accessible, or does not exist: [RawBody]

FeedItem post = new FeedItem();
                post.ParentId = recipientId;
                post.CreatedById = loggedUser;
                post.IsRichText = true; 
                post.Body = message+'<p>&nbsp;&nbsp;</p><img src="/img/rypple/Thanks.png">'+badgeReceived.Description;
                post.RelatedRecordId = thanks.Id;
                insert post;
The APEX Dev guide says that you can use a helper method to simplify doing @mentions in chatter posts. I can't get the helper mothod to work. I am getting an error using the example code from the github site. 

Dev Guide:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/connectapi_examples_post_feed_element_mention.htm
Link to helper on github:
https://github.com/forcedotcom/ConnectApiHelper

Code:
ConnectApi.FeedItem fi = ConnectApiHelper.postFeedItemWithMentions(Network.getNetworkId(), 'me', 'Hey there {005D00000015tjz}, how are you?');
Error Message:
Illegal assignment from ConnectApi.FeedElement to ConnectApi.FeedItem
 
Hi All,

I have a button and a textbox in vf page. I want when i click the button the focus should go to textbox. Below is my vf page - 

        <apex:commandbutton value="Search" action="{!FindAllName}" rerender="geographies" oncomplete="renderChosen()" style="width:120px;margin-left:30px;" status="actStatusId" id="cmdbutton" />    
                        </div>
                        
                        <apex:actionStatus id="actStatusId">
                            <apex:facet name="start" >
                                <apex:image url="/img/loading32.gif" width="15" height="15"  style="float:left;margin-left: 430px;;margin-top:-16px;"/>              
                            </apex:facet>
                        </apex:actionStatus>
                        
                        
                        <apex:pageBlockSectionItem id="geo">
                            <apex:outputLabel value="{!$ObjectType.RFP__c.Fields.Geography__c.Label}"  style="width:87%; float:right;height:12px;font-weight:bold;font-family:Arial;font-size:11px;color:#2F4F4F;"/>
                            <apex:outputPanel id="geographies" layout="block"  styleClass="requiredInput" style="width:82%; float:right;margin-top:-10px;">
                                <apex:outputPanel id="geos" layout="block"  styleClass="requiredBlock"/>
                                <apex:outputText value="Please Refine Your Search" rendered="{!IF(results >1000,'true','false')}" style="margin-left:-2px;width:100%; margin-top:-10px;font-weight:bold;font-family:Arial;font-size:11px;color:red;"/>
                                <apex:outputText value="No Results Found" rendered="{!IF(results ==0,'true','false')}" style="margin-left:-2px;width:100%; margin-top:-10px;font-weight:bold;font-family:Arial;font-size:11px;color:black;"/>
                                <apex:selectList value="{!selectedGeographyIds }" multiselect="true" id="selectedGeographies" styleClass="fullWidth chzn-select" >
                                    
                                    <apex:selectOptions value="{!AllName}" id="movieTextBox"></apex:selectOptions>
                                    
                                </apex:selectList>
                                
                                <apex:outputPanel layout="block" styleClass="errorMsg" >
                                    <apex:outputText value="{!errorMap['selectedGeographies']}" 
                                                     escape="false" rendered="{!errorMap['selectedGeographies'] != ''}" />
                                </apex:outputPanel>
                            </apex:outputPanel>
                        </apex:pageBlockSectionItem>
                    </apex:actionregion> 

Regards
hi all,

I urgently need to edit/delete a post made by me on this discussion forum...But its not allowing me to do so and pops up
saying that 'you cant delete this question as others are interested in it'.
There are no likes and no comments on it still i am unable  to delete it
Any help would be highly appreciated

Its very urgent,
Thanks,