0

I am trying to create a formula to output either true/false or 1/0 if field Salesloft_Cadence contains the text "EMEA" I get the following error message. Suggestions?

CONTAINS(Activity.SalesLoft1__SalesLoft_Cadence_Name__c,"EMEA")

Error code: Warning Error when encoding row-level formula: Formula result is data type (Boolean), incompatible with expected data type (Number).

6
  • I hope you have given formula return type as Number Can you change it to Boolean and check it Sep 30, 2022 at 9:33
  • I'm sorry, I dont 100% get what you mean, I have selected formula return type as Number? I dont get an option for Boolean Sep 30, 2022 at 9:43
  • A small correction . In salesforce Boolean means Checkbox. Can you check it . Sep 30, 2022 at 9:45
  • Again apologies as you can probably tell I'm fairly new to this, where is it you want me to change the boolean? I can't see it. I am looking to group the field 'Salesloft_Cadence_Name' by whether that field contains certain characters, for example if the name contains 'EMEA' I want them to be grouped together so that I can see unique activity in EMEA, and if the name contains 'APAC' I'd like them to be grouped together, if that makes sense? Sep 30, 2022 at 9:53
  • I mean when you create field select Formula and then give the name which you want and then select checkbox and then enter the formula which you have so for Name which Contains EMEA it checks the checkbox field Sep 30, 2022 at 9:58

1 Answer 1

1

For row-level formulas in reports you can indeed only have Number, Date, DateTime or Text as an output. In this case you have selected Number.

The outcome of your formula, however, is a Boolean, i.e. the fact whether or not the field contains the value 'EMEA':

CONTAINS(Activity.SalesLoft1__SalesLoft_Cadence_Name__c,"EMEA")

You could convert that to a number (e.g. 0 or 1) quite simply by surrounding your formula with an IF statement, that outputs 1 if true and 0 if false.:

IF(CONTAINS(Activity.SalesLoft1__SalesLoft_Cadence_Name__c,"EMEA"),1,0)
7
  • Thank you, the suggestion works well, do you know if there would be a way for me to then differentiate between more than one value? For example get different outputs for whether the field contains 'EMEA' 'APAC' or 'Americas' so that I would be able to get a total for each group of values? Sep 30, 2022 at 12:13
  • You could just group the report by that SalesLoft_Cadence_Name field..? Sep 30, 2022 at 12:19
  • Yes, the only problem is we have many different values in the field without any constant, I was hoping for a way to group these values by whether they contain certain values. For example if two values in the field were '2022 EMEA Push' and 'Q4 EMEA' I would want both to be grouped together by the fact they contain 'EMEA' and then the same for 'APAC' and 'Americas' if that makes sense. Sep 30, 2022 at 12:57
  • Then you could create 3 row-level formula fields and then calculate the SUM over those with a report summary field. Since the ones with 'true' will have a 1, the SUM will tell you the number of records with EMEA (or one of the others) in the name. Sep 30, 2022 at 14:24
  • Thanks and I appreciate this would be a great solution, unfortunately, Salesforce limits row-level formula fields to 1 per report, not sure if there would be a work around to this? Sep 30, 2022 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.