0

Could you please help me on this?

Existing Scenario: Records from two different objects ObjectA and ObjectB are displayed in a page as a news feed in ascending order of modifieddate. When click on a custom link labelled as "comment" in the feed page, the chatter:feed corresponding to the record would be appeared where a user can post a comment, attach a file, bookmark and delete an existing post (standard features). Currently, the custom link "comment" is appearing for feeds from ObjectA and hence the chatter:feed is linked to the records from ObjectA.

Requirement: Now, the similar functionality (a custom link "comment" and when user clicks on this link then a chatter:feed needs to be revealed) is required to be handled for ObjectB. Since we can not handle more than chatter component in same page I am looking for a work around to achieve this.

Hi @crmprogdev, (I just edited to answer your query) The record-id in the variable "idAsuserClicks" (assigned within a javascript code) which is passed to controller using actionfunction method shown below and the ObjectA is referred for the entity-id of chatter component in the div "TestDiv" shown below. Now I need to invoke and assign in similar way the record-id of ObjectB and refer the Object dynamically for the entity-id of chatter:feed component since more than one chatter:feed component can not used in the same page.

Page:

<apex:actionFunction name="assignRecordToChatterJS" action="{!entityidassigning}"   
 rerender="rerenderingfromActionFunction" oncomplete="TestOncomplete();">
 <apex:param id="paramid" name="paramname" assignTo="{!idAsUserClicks}" Value="" /> 
</apex:actionFunction>

<div id="TestDiv" Class="TestClass1" style="z-index: -50; position: absolute; top: -10px; 
  width: 0px;display:none;" >
 <apex:outputPanel id="rerenderingfromActionFunction" styleClass="testClass" 
      layout="block" rendered="{!Not(ObjectA.HComments__c)}">
    <div id="Div-1" Class="MFClass" style="position: relative; margin-top: -15px;">
       <div>                     
          <chatter:feed entityId="{!IF(TempFeedEntity.id !=null, TempFeedEntity.id, 
            ObjectB.id)}" rendered="true"/> 
       </div>
    </div>
 </apex:outputPanel>                    
</div>  

Controller:

public pageReference entityidassigning() {
TempFeedEntity.id = new ObjectA__c(id=idAsUserClicks); id ObjectAId = (id)ApexPages.currentPage().getParameters().get('paramname');
return null; }

  • Could you show us what code you've written thus far and where you're "stuck"? Its always helpful to see what someone has done and the effort they've put into trying to solve a problem themselves before trying to assist them. – crmprogdev Jul 7 '14 at 14:20
  • echoing @crmprogdev -- you could help us help yourself by rewriting your problem statement in simpler declarative English. Your sentences are hard to decipher. – cropredy Jul 7 '14 at 17:00
  • Hi @crop1645, the problem statement has been rephrased. – vedakri Jul 8 '14 at 14:39
  • @Karthi Velu is on to the solution here -- in your controller, the ID field can be tested to see whether it is object A or object B - then you can construct dynamic SOQL accordingly – cropredy Jul 8 '14 at 17:07
0

Hope one the of the way you can do it 1. Write the query in apex with dynamic soql 2. Use the instanceOf keyword to identify which object type from the soql. 3. you may verify with starting 3 char of record ID whic you are passing from JS function.

Also, If you post the controller code. then ezy to guide.

| improve this answer | |
  • @Kathir velu, I have given a piece of code from controller for your reference and assistance. – vedakri Jul 9 '14 at 8:13

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.