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
SFDCneophyteSFDCneophyte 

Custom field to give a value from Lead or Contact fields

I've created three fields , one on the lead page, the second on the contact page and a third on the campaign members page. But I looking for a formula to be used on the campaign member page that would read the value of the  lead or conatct page fields. It would be either or. The list is also a pick list...

 

TEXT( Lead.Lead_Source_Segment__c )
TEXT( Contact.Lead_Source_Segment__c )

 

IF(NOT(ISBLANK(Lead.Lead_Source_Segment__c ))&& ISBLANK(Contact.Lead_Source_Segment__c ), Lead.Lead_Source_Segment__c
IF(NOT(ISBLANK(Contact.Lead_Source_Segment__c ))&& ISBLANK(Lead.Lead_Source_Segment__c), Contact.Lead_Source_Segment__c ,
IF(NOT(ISBLANK (Lead.Lead_Source_Segment__c ))&& NOT(ISBLANK(Contact.Lead_Source_Segment__c )), Contact.Lead_Source_Segment__c ,
null)))

 

Error: Syntax error. Found 'Lead.Lead_Source_Segment__c

 

IF(NOT( ISPICKVAL(Lead.Lead_Source_Segment__c ))&& ISPICKVAL(Contact.Lead_Source_Segment__c ), Lead.Lead_Source_Segment__c
IF(NOT(ISPICKVAL (Contact.Lead_Source_Segment__c ))&& ISPICKVAL(Lead.Lead_Source_Segment__c), Contact.Lead_Source_Segment__c ,
IF(NOT(ISPICKVAL (Lead.Lead_Source_Segment__c ))&& NOT(ISPICKVAL(Contact.Lead_Source_Segment__c )), Contact.Lead_Source_Segment__c ,
null)))

 

Error: Syntax error. Found 'Lead.Lead_Source_Segment__c'

 

Best Answer chosen by Admin (Salesforce Developers) 
phiberoptikphiberoptik

Already replied to your PM about this. Just saw this post. You didnt mention what the error message was in your PM.


Error message was from the lack of a comma at the end of the first line (technically the second line in your post above).



All Answers

phiberoptikphiberoptik

Already replied to your PM about this. Just saw this post. You didnt mention what the error message was in your PM.


Error message was from the lack of a comma at the end of the first line (technically the second line in your post above).



This was selected as the best answer
SFDCneophyteSFDCneophyte

IF(TEXT(Lead.Lead_Source_Segment__c) <> ""&& TEXT(Contact.Lead_Source_Segment__c)= "", Lead.Lead_Source_Segment__c,
IF(TEXT(Contact.Lead_Source_Segment__c) <> ""&& TEXT(Lead.Lead_Source_Segment__c)= "", Contact.Lead_Source_Segment__c,
IF(TEXT(Lead.Lead_Source_Segment__c) <> "" && TEXT(Contact.Lead_Source_Segment__c) <> "", Contact.Lead_Source_Segment__c ,
null)))

 

Error: Field Lead_Source_Segment__c is a picklist field. Picklist fields are only supported in certain functions

 

phiberoptikphiberoptik

Sorry mate, forgot to wrap the "then" part of the IF() statements in TEXT() functions

 

IF(TEXT(Lead.Lead_Source_Segment__c) <> ""&& TEXT(Contact.Lead_Source_Segment__c)= "", TEXT(Lead.Lead_Source_Segment__c),
IF(TEXT(Contact.Lead_Source_Segment__c) <> ""&& TEXT(Lead.Lead_Source_Segment__c)= "", TEXT(Contact.Lead_Source_Segment__c),
IF(TEXT(Lead.Lead_Source_Segment__c) <> "" && TEXT(Contact.Lead_Source_Segment__c) <> "", TEXT(Contact.Lead_Source_Segment__c) ,
null)))