0

I am trying to set a picklist value through URLFOR in custom link button but not able to. I tried these different options as like below but always getting different error 1)

{!URLFOR('/lightning/o/Opportunity/new?defaultFieldValues=Activism_cb__c='+IF(TEXT(M_A_Lead_Tracker__c.Type__c) == 'Activism' , 'true','false')+',Name='+M_A_Lead_Tracker__c.Bidder__c+'-EGM-'+ TEXT(YEAR( TODAY())),Opportunity.LeadSource='Advisor Referral'

)}

Error

Error: Field Opportunity.LeadSource is a picklist field. Picklist fields are only supported in certain functions
{!URLFOR('/lightning/o/Opportunity/new?defaultFieldValues=Activism_cb__c='+IF(TEXT(M_A_Lead_Tracker__c.Type__c) == 'Activism' , 'true','false')+',Name='+M_A_Lead_Tracker__c.Bidder__c+'-EGM-'+ TEXT(YEAR( TODAY())),Opportunity.LeadSource=TEXT('Advisor Referral')

)}
Error: Field Opportunity.LeadSource is a picklist field. Picklist fields are only supported in certain functions

Even i removed all the fields and tried only with Opportunity.LeadSource but not able to resolve. If I am not using URLFOR then its working but I need this condition with URLFOR only as I have to pre populate some fields.

Thanks

3
  • wrapping Opportunity.LeadSource in TEXT() doesn't work? e.g. TEXT(Opportunity.LeadSource)
    – Nick C
    Commented Jun 23, 2021 at 5:30
  • @NickCook , I tried like this and its not working {!URLFOR('/lightning/o/Opportunity/new?defaultFieldValues=TEXT(LeadSource)=Advisor Referral')} , {!URLFOR('/lightning/o/Opportunity/new?defaultFieldValues=TEXT(LeadSource)=TEXT(Advisor Referral)')} 0r {!URLFOR('/lightning/o/Opportunity/new?defaultFieldValues=TEXT(Opportunity.LeadSource)=Advisor Referral')} and nothing is working
    – klnavi
    Commented Jun 23, 2021 at 6:04
  • FInally if I put like this then its working {!URLFOR('/lightning/o/Opportunity/new?defaultFieldValues=LeadSource=Advisor Referral,Activism_cb__c='+IF(TEXT(M_A_Lead_Tracker__c.Type__c) == 'Activism' , 'true','false')+',Name='+M_A_Lead_Tracker__c.Bidder__c+'-EGM-'+ TEXT(YEAR( TODAY() )) )}
    – klnavi
    Commented Jun 23, 2021 at 6:17

1 Answer 1

1

Going by the error message, did you try below?

{!URLFOR('/lightning/o/Opportunity/new?defaultFieldValues=Activism_cb__c='+IF(TEXT(M_A_Lead_Tracker__c.Type__c) == 'Activism' , 'true','false')+',Name='+M_A_Lead_Tracker__c.Bidder__c+'-EGM-'+ TEXT(YEAR( TODAY())),ISPICKVAL(Opportunity.LeadSource, TEXT('Advisor Referral')))}

(or)

{!URLFOR('/lightning/o/Opportunity/new?defaultFieldValues=Activism_cb__c='+IF(TEXT(M_A_Lead_Tracker__c.Type__c) == 'Activism' , 'true','false')+',Name='+M_A_Lead_Tracker__c.Bidder__c+'-EGM-'+ TEXT(YEAR( TODAY())),ISPICKVAL(Opportunity.LeadSource,'Advisor Referral'))}

Let me know if it helps!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .