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
Glen.ax1034Glen.ax1034 

Passing from APEX to VF Page NewbLogic

I currently have the code on my visual force page... because I am not the isUser but I want to make sure that for the isUser that it displays correctly. My question is how do I get this to output the related list? as of right now it is outputting attached screenshot as opposed to the related list.

 

 

VF PAGE:

 

<apex:page standardController="Contract" extensions="contractextensions">
       <apex:outputText value="{!Contract.Salesperson__c}" rendered="false"/>
     {!IF(isUser,"<apex:relatedList List=\"NotesAndAttachments\"></apex:relatedlist>","<apex:relatedList List=\"NotesAndAttachments\"></apex:relatedlist>")}
</apex:page>

 

APEX Extension Controller:

public class contractextensions {
    private final Contract contractObj;
    public contractextensions(ApexPages.StandardController controller) {
        this.contractObj= (Contract)controller.getSubject();
    }

    public boolean getisUser()
    {
        if(UserInfo.getUserId()== contractObj.Salesperson__c) {
            return True;
        } else {
            return False;
        }
        
    }
}

 

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
aballardaballard

You can't con ditionally generate markup in this way.   Use the 'rendered' attribute on the component to determine whether it renders or not

e.g.

 

<apex:relatedlist ist= ...  rendered="{!isUser}  ... />

All Answers

aballardaballard

You can't con ditionally generate markup in this way.   Use the 'rendered' attribute on the component to determine whether it renders or not

e.g.

 

<apex:relatedlist ist= ...  rendered="{!isUser}  ... />

This was selected as the best answer
Glen.ax1034Glen.ax1034

Hey, new problem that is a derivative of the old problem. When I click the new note.... it doesnt open up the thing in a new page? what'd i do wrong