You need to sign in to do that
Don't have an account?
Parvinder Chana
use of if condition in visual force page
Hello,
I'm creating a visual page page to show custom link to reports and everything worked great.
I have few custom fields on account object which I will use to show custom link and I need help to use if condition something like this
if account.Relation = "Partner" then show link to a report
else if account.relation = "Customer" then show link to another report
else don't show link at all.
I'm sure it is achieveable but need help.
Thanks,
P
I'm creating a visual page page to show custom link to reports and everything worked great.
I have few custom fields on account object which I will use to show custom link and I need help to use if condition something like this
if account.Relation = "Partner" then show link to a report
else if account.relation = "Customer" then show link to another report
else don't show link at all.
I'm sure it is achieveable but need help.
Thanks,
P
Otherwise, you could use the rendered attribute with an IF statement:
<apex:variable var="d" value="/reportid?pv0={!SUBSTITUTE(SUBSTITUTE(Account.Name,'&', '%26'),'#','%23')}"/>
<apex:variable var="l" value="{!IF((CONTAINS(Account.Relationship_A__c, 'Owner') || CONTAINS(Account.Relationship_B__c, 'Owner') || CONTAINS(Account.Relationship_C__c, 'Owner')) , 'Show me locations owned by this owner ' & Account.Name & '?' , '')}" />
<p>
<a href="{!IF((CONTAINS(Account.Relationship_A__c, 'Owner') || CONTAINS(Account.Relationship_B__c, 'Owner') || CONTAINS(Account.Relationship_C__c, 'Owner')) , d, '')}" target="_blank">{!l}</a>
</p>
Basically, I stored the information in a variable then using that in link?
Thanks,
Parv