You need to sign in to do that
Don't have an account?

Check condition in visual force
Hi
in my VF page i want to render a related list only for one logged in user . can any one provide me the Syntax
This is a Standard controller on contact
here are the ways i am trying and no success yet
<apex:relatedList list="Executive_Notes__r" rendered="{$USER.id = '222222222"}/>
and i cretaed a formula filed on contacts to get the logged in person id and check it but even that doesnt work.
<apex:relatedList list="Executive_Notes__r" rendered="{!(Contact.Executive_Note__c == '005300000040xoB' )}"/>
Thanks
I think you need to use the 18-character user Id, therefore try
<apex:relatedList list="Executive_Notes__r" rendered="{!$USER.Id = '00530000004zr4EAAQ'}"/>
All Answers
<apex:relatedList list="Executive_Notes__r" rendered="{!$USER.Id = '222222222'}"/>
Hi,
Try this , You are missing the $ Symbol. Check this for more details.
<apex:relatedList list="Executive_Notes__r" rendered="{!$USER.Id = '1100283848'}"/>
Hope this helps.
Important :
Click on the Star Icon aside if this post provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.
Thank You
<apex:relatedList list="Executive_Notes__r" rendered="{!if($USER.id == '222222222',true,false)}"/>
Hi Guys ,
I tried all three but no luck yet
<apex:relatedList list="Executive_Notes__r" rendered="{!$USER.Id ='00530000004zr4E'}"/>
<apex:relatedList list="Executive_Notes__r" rendered="{!if($USER.id == '00530000004zr4E',true,false)}"/>
For some reason it is not showing up , the code saves perfectly no errors and even if i remove the condition then related list shows up but the condition is not working.
Thanks
Akhil
I think you need to use the 18-character user Id, therefore try
<apex:relatedList list="Executive_Notes__r" rendered="{!$USER.Id = '00530000004zr4EAAQ'}"/>
Hi Akhil ,
Please try this , This will work surely .. I have tried this in my DEV org and I find that when user ID is 00590000000zssSAAQ then the related list is showing up. Mark it as a solution if this works correctly or let me know if you face trouble in this again.Also , Click the Star Icon to Hit Kudos , If this post os helpful for you.
Some points to be noted is :-
1. It takes 18 digit Id as you are referencing using $ global.
2. Make sure that you have == instead of = .
3. The quote below checks if a user have id = 00590000000zssSAAQ, then it will render the related list else not.
4. Now the quote below checks the User id , if it is not 00590000000zssSAAQ, then it will render.
5. Read This for More details over Related Lists.
Important :
Click on the Star Icon aside if this post provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.
Thank You