You need to sign in to do that
Don't have an account?
Michael3.Brown
Can You Use Conditions in VF to Display Certain Fields?
I have a custom object in SalesForce called Pipeline_Tracker__c. One of the fields on this object is "Owner." On my VisualForce report, I have a table set up with <apex:repeat> tags to display all the records in my Pipeline Tracker object. When it comes to the owner field, I want to be display it as long as there is a value. However, if no owner is listed, I want to instead display the Account owner from the related account object..
Is there a way to do something like this in VisualForce? Basically, "if Owner__c" is null, display Account__r.Owner"
Thanks,
Mike
You can indeed do this. There's a few ways, here's one that should do it. Both fields are present, but only one is rendered:
All Answers
You can indeed do this. There's a few ways, here's one that should do it. Both fields are present, but only one is rendered:
You can write it like this
Or
in this only one will be displayed
Awesome. Thanks, Bob! I was unaware that's what the rendered attribute did. That definitely made things simple and solved my problem.
Cross post
Thanks Shashikant for replying as well. I had no idea you could use IF statements within VisualForce. I will definitely be able to try and apply that to other scenarios.
Thanks!
Mike
I just assume now that you, me and Ankit will reply to every post :)
Yes seems we should schedule our timings now , otherwise many cross post are in waiting :)
Haha, good one Bob. Will join you guys after 2-3 hours.
Need to go some where (arghhh).
Thanks
Ankit Arora
Blog | Facebook | Blog Page