Skip to main content

I could use some help on a Visualforce page, assuming this is possible.

 

We have a simple Visualforce page coded as follows:

<apex:page standardController="Case" showHeader="false" sidebar="false">

     <c:CaseCommentsComponent CurrentCaseId="{!Case.Id}"/> 

</apex:page>

 

I know that I can put an If statement into the above code - for example:

{! IF(Case.Status = "Closed", "Sorry Case is Closed", "Case is Open") }

This displays the hard-coded text according to the status of the case.  But what I would like to do is call one Visualforce component if the case is closed and a different component if the case is open.  Is it possible to do this?  Something like the following (although I know this doesn't work as coded)?

 

<apex:page standardController="Case" showHeader="false" sidebar="false">     

 

{! IF(Case.Status = "Closed", <c:ClosedCaseCommentsComponent CurrentCaseId="{!Case.Id}"/>, <c:CaseCommentsComponent CurrentCaseId="{!Case.Id}"/>) } 

 

</apex:page>

 

#Visualforce Pages  #Developer Forums  #Service Cloud

1 件の回答
  1. 2021年8月27日 17:42

    So after additional research, I found a solution that appears to be working.  I added the rendered statement instead of an IF statement:

     

    <apex:page standardController="Case" showHeader="false" sidebar="false">     <c:CaseCommentsComponent CurrentCaseId="{!Case.Id}" rendered="{!IF(Case.Status<>'Closed',true,false)}"/>     <c:ClosedCaseCommentsComponent CurrentCaseId="{!Case.Id}" rendered="{!IF(Case.Status='Closed',true,false)}"/> </apex:page>

0/9000