+ Start a Discussion
brkandivybrkandivy 

Need Help with this formula for a field update

Trying to create a field update to pull data from a Picklist field from the Product2 object to a text field on the opportunity product object.  Have tried various things like single quotes vs. double quotes, and && or ||  not sure what else to try here.

 

Keep getting various syntax errors...

 

IF(ISPICKVAL(Product2.Family,"SNS Surveyor"),'SNS Surveyor’  ||

IF(ISPICKVAL(Product2.Family,"SNS Event Monitoring"),'SNS Event Monitoring'  ||

IF(ISPICKVAL(Product2.Family,"SNS Services"),'SNS Services', "")))

 

Error: Syntax error. Missing '

 



Best Answer chosen by Admin (Salesforce Developers) 
Steve MolisSteve Molis

Also, if you want to access the standard Product Family picklist field from the Opportunity Product object, I think you need to go throught the PriceBook object.  You could also use a CASE function like this:

 

CASE(PricebookEntry.Product2.Family,
"SNS Surveyor", "SNS Surveyor", 
"SNS Event Monitoring",,"SNS Event Monitoring",
"SNS Services", "SNS Services",
NULL)

 

All Answers

Steve MolisSteve Molis

Can you post a screenshot of the error message you're getting?

 

IF(ISPICKVAL(Product2.Family,"SNS Surveyor"),'"SNS Surveyor",
IF(ISPICKVAL(Product2.Family,"SNS Event Monitoring"),"SNS Event Monitoring",
IF(ISPICKVAL(Product2.Family,"SNS Services"),"SNS Services", 
NULL)))

 

Steve MolisSteve Molis

Also, if you want to access the standard Product Family picklist field from the Opportunity Product object, I think you need to go throught the PriceBook object.  You could also use a CASE function like this:

 

CASE(PricebookEntry.Product2.Family,
"SNS Surveyor", "SNS Surveyor", 
"SNS Event Monitoring",,"SNS Event Monitoring",
"SNS Services", "SNS Services",
NULL)

 

This was selected as the best answer
brkandivybrkandivy

This is one:

IF(ISPICKVAL(Product2.Family,"SNS Surveyor"),'"SNS Surveyor",

IF(ISPICKVAL(Product2.Family,"SNS Event Monitoring"),"SNS Event Monitoring",

IF(ISPICKVAL(Product2.Family,"SNS Services"),"SNS Services", NULL)))

 

Error: Syntax error. Missing '

 

Another:

IF(ISPICKVAL(Product2.Family,"SNS Surveyor"),"SNS Surveyor" ||

IF(ISPICKVAL(Product2.Family,"SNS Event Monitoring"),"SNS Event Monitoring" ||

IF(ISPICKVAL(Product2.Family,"SNS Services"),"SNS Services", "")))

 

Error: Incorrect parameter for function 'or()'. Expected Boolean, received Text

 

Another:

IF(ISPICKVAL(Product2.Family,"SNS Surveyor"),"SNS Surveyor" &&

IF(ISPICKVAL(Product2.Family,"SNS Event Monitoring"),"SNS Event Monitoring" &&

IF(ISPICKVAL(Product2.Family,"SNS Services"),"SNS Services", "")))

 

Error: Incorrect parameter for function 'or()'. Expected Boolean, received Text

Steve MolisSteve Molis

Yeah, you've got all kinds of problems in that formula, you're better off just going with a CASE function like the one I posted.

brkandivybrkandivy

Thanks this worked like a dream. 

Steve MolisSteve Molis

No problem

 

You owe me a beer!