0

I have the following piece of code in my visualforce page

<apex:pageBlockTable value="{!AModel.RelFeedItems}" var="Feeds">
               <apex:column >
                    <apex:facet name="header">Date</apex:facet>
                    <apex:outputField value="{!Feeds.CreatedDate}" />
                </apex:column>
               <apex:column >
                    <apex:facet name="header">Body</apex:facet>
                    <apex:outputText value="{!Feeds.Body}" />
                </apex:column>
                <apex:column >
                    <apex:facet name="header">ModStamp</apex:facet>
                    <apex:outputField value="{!Feeds.SystemModstamp}" rendered="insertedbyid!=createdbyid"/>**!--I want some thing like this--**
                </apex:column>
                <apex:column >
                    <apex:facet name="header">Inserted By Name</apex:facet>
                    <apex:outputField value="{!Feeds.InsertedBy.name}" />
                </apex:column>
          </apex:pageBlockTable>  
            </apex:pageBlock>

What i want is that the modtamp field to be displayed only when insertedbyid!=createdbyid otherwise it should display a null value.

  • I guess Inserted by Id and created by Id always be same user.. Any user case where these 2 values will be different ? – Ratan Paul Jun 6 '16 at 10:53
  • rendered="{! feeds.insertedbyid!=feeds.createdbyid}" You can try this. – Mr.Frodo Jun 6 '16 at 10:54
  • @Ratan no, in my case it is different – Rimii Jun 6 '16 at 10:54
  • Rimii any use case.. I love to hear you out? – Ratan Paul Jun 6 '16 at 10:56
  • @Ratan in my code, there are two separate set of users, one, for whom the feeditem is going to be inserted, another one is going to insert the feeditem on his behalf.. That is why in my code I am explicitly giving the permission to change the createdbyid. That is why the createdbyid and insertedbyid are different. – Rimii Jun 6 '16 at 11:06
1

Use IF condition inside the rendered attribute of <apex:outputField to get the desired result.

<apex:outputField value="{!Feeds.SystemModstamp}" rendered = "{! If(insertedbyid!=createdbyid ,true,false) }"/>

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.