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
sparkysparky 

formula based on Record Type?

Can a formula take Record Type into consideration?  (for Opportunities, for example).  It seems like a pretty basic thing, but I don't see how to do it either in the formular builder UI or in the documentation I've been able to find so far.

Thanks!
SteveBowerSteveBower
Can't you use "{!Type}" in Formula statements, etc. 
Steve Bower
sparkysparky
Yes, but the field Type (in Opportunities) is not the same thing as Record Type.  Type is a picklist field (Existing Customer, New Customer, etc.) where Record Type is the general categories that you can use to define different layouts.  It confused me at first too.

I don't see Record Type in the field selector, and the formula builder doesn't recognize {!Record_Type}.





SteveBower wrote:
Can't you use "{!Type}" in Formula statements, etc. 
Steve Bower



SteveBowerSteveBower
Lol, that's what comes from firing off quick responses from memory.  My apologies, it's obvious if you go look at it.  But, now that I have, back to your problem.

I don't see any programmatic way of doing it using a built-in "{!...} string, but perhaps (and I stress "perhaps" because it's even later in the evening than it was when I first responded :-)  ) you can do it with a backdoor somehow. 

I haven't tried this completely, but could you create a read-only picklist field for Opportunity which you will use as a proxy for Record type by selecting a different default value for the picklist selection for each type?

Then you could query the value of that picklist field with the {!xxx} construct as a proxy for the record type?

Just a thought.  Now it's time to go to sleep.  Good luck, sorry for my "{!Type} digression.

Steve.
sparkysparky
Believe it or not, I actually thought of that.  A klugey workaround for sure, but it could work.

What I don't know is: can I get that picklist field to populate even if it's not on the layout used to enter the Opps?

(I can of course test this, but if anyone wants to save me the trouble...)



SteveBower wrote:

I haven't tried this completely, but could you create a read-only picklist field for Opportunity which you will use as a proxy for Record type by selecting a different default value for the picklist selection for each type?



ScotScot
You may also have to verify that picklist would get updated to the new default if the record type changed...
sparkysparky
I didn't know that record types could be changed once they're set.  I don't get an option to do that on the edit screen.  Perhaps it's an option I need to enable somewhere? 

In any case, I actually don't want the users to be able to do that.  The record types in this case will be different enough from each other that I won't want them morphing from one to the other.

So you agree that there's no way to reference record type directly in a formula?

Thanks!

Scot wrote:
You may also have to verify that picklist would get updated to the new default if the record type changed...


ScotScot

The change to record type works like the change to the owner ... via a link on the display (not edit) page. This presumes, of course, that you've put the record type field on the page layout.

I don't see any way to reference the record type directly in a formula. 

The previously suggested custom picklist ... with a different default (and only) value for each record type .. seems the best alternative, particularly if you won't be changing record types.

sparkysparky
FYI to anyone reading this thread:
I did verify that a picklist set to default based on Record Type will be populated even if the picklist field isn't on the layout used by a particular record type.

Also, as a further workaround if I want to display the record type but not allow my users to change it: I can create a formula field set equal to my picklist field and display that in lieu of Record Type.