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
AddnonAddnon 

Case Formula

Hi,

 

I am trying to create a Case formula, but only getting "OTHER" for all records.

 

CASE(  $UserRole.Name  ,
                "BRK Rep", "CORE",            
                "BRX Rep", "CORE",              
                "Bulk", "BULK",
                "Commercial Strategic Accounts", "STRATEGIC",
                "Construction Specialist Rep","CORE",         
                "CT Rep", "CORE",
                "Enterprise Rep", "CORE",
                "LIE Rep","CORE",
                "LIW Rep", "CORE",
                "Manager for Sales Agent", "AGENT",
                "NJC Rep", "CORE",              
                "NJN Rep", "CORE",
                "NJS Rep", "CORE",
                "Power to Learn", "POWER TO LEARN",
                "Power to Learn Sales", "POWER TO LEARN",
                "Power to Learn Sales Agents", "POWER TO LEARN",
                "WC Rep", "CORE",
             "OTHER")

Best Answer chosen by Admin (Salesforce Developers) 
MarcPannenberg.ax1843MarcPannenberg.ax1843

Hi Addnon,

 

the problem is that formula fields are (re-)evaluated when the record is retrieved. So, whoever is looking at the case will see whatever is the value for their role, no matter what.

 

If you want to stamp the case with the Role category when it is created, then I would suggest using a Text field with your exact formula as the default value. You can make this field read-only for all profiles if you don't want users to change it. It should still accept the default value.

All Answers

MarcPannenberg.ax1843MarcPannenberg.ax1843

Hi Addnon,

 

the problem is that formula fields are (re-)evaluated when the record is retrieved. So, whoever is looking at the case will see whatever is the value for their role, no matter what.

 

If you want to stamp the case with the Role category when it is created, then I would suggest using a Text field with your exact formula as the default value. You can make this field read-only for all profiles if you don't want users to change it. It should still accept the default value.

This was selected as the best answer
AddnonAddnon

Thanks for the quick reply.

 

I didn't realize I was using the UserRole rather than Owner Role.  I created a field to stamp Owner name and then referred that field in the Case.

 

Worked like a charm.  Thanks