+ Start a Discussion
Keith ShapiroKeith Shapiro 

Yes or No

I have a custom object that has an email field. I would like to either, show the email matches the email field in the lead record or if it's possible not show the field at all if it does match. Sometimes people use a different email to join a webinar than whats in the record

Thanks!
David ZhuDavid Zhu
Not sure if the following works for you.

Put email addres field in an outputpanel and use "rendered" attribute, the value of rendered attribute links to a boolean in custom controller.

<apex:outputpanel id='xxxx' rendered = '{!displayemail}'>
    <apex:outputfield value = '{!email}'/>
</apex:outputpanel>
ra1ra1
If you are using custom VF page to display the records, then David solution should work for you where you can control the visibility & display value within your controller class.

If you are using standard page, then you can also use the FORMULA field (code snap below) to control the display value where if email matches then show email else it can be empty (or any other value like "Mismatched Email"). 
IF(Lead__r.Email =  Email__c, Email__c, "")

With this solution, we will refer only Formula field (instead of Email field) on page layout.


 
YuchenYuchen
Does your custom object lookup Lead object? If it does and if you do not want to create custom VF page, you can create a formula like this:

if( Test_Email__c = Lead__r.Email, 'Match Lead Email', 'Not Match Lead Email: '+Lead__r.Email )

So it will display "Match Lead Email" if they are same, and display "Not Match Lead Email" together with the Email of Lead if it is not same.
Keith ShapiroKeith Shapiro
With both of these solutions I get an error
User-added image
ra1ra1
Do you have a custom field on this object which is lookup to Lead?

if yes, then what is its API Name and if it is not Lead__c then you need to replace it with appriopriate api name.
For Eample: MyLead__c then replace "Lead__r" with "MyLead__r".

In case this too is not working, then requesting you to share the screenshot of your custom lookup(Lead) detail.


Thanks,
Keith ShapiroKeith Shapiro
Ok, the api name is Webinar_Email_Given_c I no longer get the field not found error but now I do get it on the Email__c how do I reference the email field in the Lead Object in this formula? Keith Shapiro Exodus Marketing 800-315-1910 Ext. 1101 Twitter: @exodusmarketing http://www.xomark.com
Keith ShapiroKeith Shapiro

here Yuchen hopefully this is what you were asking for.

User-added image

YuchenYuchen
You can try the following formula:

IF(Webinar_Lookup__r.Email = Webinar_Email_Given__c, Webinar_Email_Given__c, "")