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
Angie Harper 2Angie Harper 2 

My user object field formula does not work in my workflow?

I have a custom field on the user object to populate a field (text) and I am at my character limit. When I use the same formula in a workflow I get this error: Error: Formula result is data type (Text), incompatible with expected data type (true or false). 

​IF(TEXT(UserType)='CSN Only','Chatter Only', 
IF(CONTAINS(Profile.Name,'Agent'),'Agent',
IF(CONTAINS(Profile.Name,'Country M'),'Country Manager',
IF(CONTAINS(Profile.Name,'System Admin'), 'System Admin',
IF(CONTAINS(Profile.Name,'Marketing'),'Marketing',
IF(CONTAINS(Profile.Name,'Product')||CONTAINS(Profile.Name, 'E-S'),'Product / Implementation',
IF(CONTAINS(Profile.Name,'Sales Support'),'Sales Support',
IF(CONTAINS(Profile.Name,'Recon'),'Reconciliation User',
IF(CONTAINS(Profile.Name,'Tech Support')||CONTAINS(Profile.Name, 'On Line Support'), 'Configuration/Online Support',
IF(CONTAINS(Profile.Name, 'Client Exec') || CONTAINS(Profile.Name, 'Client Manager')|| CONTAINS(Profile.Name, 'CRM Manager')|| CONTAINS(Profile.Name, 'Customer Relations')|| Profile.Name =  'EMEA DFX', 'CRM & Dealing',
IF(CONTAINS(Profile.Name, 'Accredit') || CONTAINS(Profile.Name, 'Credit')|| CONTAINS(Profile.Name, 'Refresh') || CONTAINS(Profile.Name, 'Enrolement'),'Accreditation/Credit/Enrollment',
IF(CONTAINS(Profile.Name, 'Customer Service') || CONTAINS(Profile.Name, 'Customer Support')||CONTAINS(Profile.Name, 'Mid Office'),'Client Support & Customer Service',
IF(Profile.Name ='GBP Global Banking Operations','Banking Implementation',
IF(CONTAINS(Profile.Name, 'FBA') || CONTAINS(Profile.Name, 'Sales Operations'),'Sales Operations & Finance',
IF(CONTAINS(Profile.Name, 'Investig') || CONTAINS(Profile.Name, 'Operations')|| CONTAINS(Profile.Name, 'Cash Letters')|| CONTAINS(Profile.Name, 'GBP NA Collections')|| Profile.Name =  'GBP NA ePay Support Rep'|| CONTAINS(Profile.Name, 'Ops')|| CONTAINS(Profile.Name, 'WU Retail Payments'), 'Operations & Investigations',
IF(CONTAINS(Profile.Name, 'Transworks') || CONTAINS(Profile.Name, 'External'),'Lead Generation External',
IF(CONTAINS(Profile.Name, 'Lead Gen'),'Lead Generation',
IF(CONTAINS(Profile.Name, 'L&D'), 'L&D',
IF(CONTAINS(Profile.Name, 'Sales Rep') || CONTAINS(Profile.Name, 'Sales Manager'),'Sales',
IF(CONTAINS(Profile.Name, 'EUR AR') || CONTAINS(Profile.Name, 'NA AR'),'AR&Collections',
IF(CONTAINS(Profile.Name, 'Compliance') ||  CONTAINS(Profile.Name, 'Derivatives'),'Compliance',
IF(Profile.Name ='GBP Global EDGE Migration User','Global SBA/VMS',
IF(CONTAINS(Profile.Name, 'API Enabled'),'EDGE HCL Support', 
IF(CONTAINS(Profile.Name, 'NA Audit') || CONTAINS(Profile.Name, 'Read Only')|| CONTAINS(Profile.Name, 'WUBS User'),'Read Only',
'Not Defined'
))))))))))))))))))))))))
Shawn Reichner 29Shawn Reichner 29
I would rework the formula you are using.  You are stating or's by || and I think you will get better results if you start your formula with an AND() statement and use OR() inside of that AND statement. 

Example:

AND(
IF(TEXT(UserType)='CSN Only','Chatter Only',
IF(CONTAINS(Profile.Name,'Agent'),'Agent',
IF(CONTAINS(Profile.Name,'Country M'),'Country Manager',
IF(CONTAINS(Profile.Name,'System Admin'), 'System Admin',
IF(CONTAINS(Profile.Name,'Marketing'),'Marketing',
IF(
OR(CONTAINS(Profile.Name,'Product'),'Product / Implementation',
CONTAINS(Profile.Name, 'E-S'),'Product / Implementation'),
If(Rest of yoru code, wrapping the OR criteria in an OR like above)

Hope that makes sense,....