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
Columba1400Columba1400 

If/Or statement using record types?

Hi folks,

 

I've got a custom object which has seven different record types, whose names are exactly as follows:

 

Child assessment

Child 8-session evaluation

Child final evaluation

Parent assessment

Parent evaluation

School assessment

School evaluation

 

These can obviously be split into three broad categories - Child, Parent and School, and I'm wanting to create a custom formula field which will do just that for reporting, but I'm struggling on the syntax of the nested IF/OR statements, using record type IDs for each of these.

 

The formula I've gone with so far is:

 

=IF

  (OR

     (Record Type = "Parent assessment", "Parent evaluation"),"parent",

        (IF

           (OR(Record Type = "School assessment", "School evaluation"),"School"),"child))

 

 

I'm typing this out from memory so I may have missed out a parenthesis or two, that's not a big deal, but when I plugged this into my formula editor, it basically said that it was expecting a boolean, which I assume is relating to my record type names.  I couldn't work out where to find my record type ID numbers, else I'd have used them instead of the record type names.

 

Any thoughts?

 

Many thanks,
Charlotte

 

Amber NeillAmber Neill

I'm not so great at troubleshooting formulas, but I can help you find the IDs for your record types.

So, the easiest way is to go to each record type detail page.  Note the URL in your browser window.  You'll see this on the end of the URL:

setup/ui/recordtypefields.jsp?id=01280000000Fso0

that last part after the "id=" is the ID of your record type!

Good luck!
Amber

Steve :-/Steve :-/

One thing that I did on our SFDC Org to make it easier to write formulas that evaluate Record Type is create a custom formula(text) field ($RecordType.Name).  That way I can use the literal "name" instead of the RecordTypeID.  

 

 

AND( (Probability >= 0.90), ISPICKVAL( Forecasted__c ,""), AND( OR( ( Record_Type__c = "Database Sales"), ( Record_Type__c = "Digital Solutions Sales"), ( Record_Type__c = "EDS Sales"), ( Record_Type__c = "SACG Sales"))))

 

 

 

StefanStefan

I may be wrong but I think a CASE statement might be better. Soemthing along the following lines e.g.

 

CASE( Contact__r.RecordTypeId ,
"012400000009cP", "Dummy",
"012400000009dgU", "End User",
"Not known")

Steve :-/Steve :-/

Now that I think of if (which is usually not a good thing) you might be able to get there just by creating a single formula(text) field $RecordType.Name and throwing some Text Formatting functions on there, like MID, LEFT, RIGHT, etc...  and parsing out the first part of your literal RecordType.Name

 

but that's just my 2 Pesos...