0

I have a custom object that has all the same fields except the value of one depends on the record type. I would imagine I could define a lengthy formula with IF but is there a cleaner way?

Ideally, I could have a related object and have each entry have their own formula supplied instead of predefined. Then I can use the value of this in the parent formula.

For example, if I have an Order object and an Order_Type object, I would like to have Order_Type have a formula field Factor but as input, not defined. Then I could use it in Order like Order_Type__r.Factor__c * Quantity.

1

What do you mean by cleaner way. The IF() can be pretty clean / easy to implement if you print it clearly.

IF(RecordType.Name = 'RT1', 'ABC',
IF(RecordType.Name = 'RT2', 'DEF',
IF(RecordType.Name = 'RT3', 'GHI',
"")))

in my opinion, this is pretty clean.

To answer your question, you can use the CASE function as well but this will only be as 'clean' as you make it as well.

CASE(RecordType.Name,
'RT1', 'ABC',
'RT2', 'DEF',
'RT3', 'GHI',
'')

This took me a few seconds to write up. it is still unclear what the problem you are facing is.

For future questions, please refer to How to Ask before writing up a question. Make sure to include a more descriptive explanation of the problem you are facing, what you have tried and what specifically you would like to know.

| improve this answer | |
  • Thank you for the clarity! I understand I'm somewhat ambiguous, but it's one of those things where you don't know what you don't know. I attempted to articulate my desire to the best of my ability, but it seems as though that the IF path is the way to go. – Benny Oct 21 '19 at 3:37
  • Glad I was able to help. It is totally acceptable to ask for best practices. I see you have updated your question, however let us know specifically what you are trying to accomplish with a clear example. It is still unclear to me what you are trying to do. i.e, I have two Objects: Order and OrderType__c. An Order is a child of OrderType. Each OrderType__c has a Factor (percentage field) and a Quantity (Number) field. I would like to display the __ in the order object. I have tried creating a formula field ___ Is there a better practice to accomplish this? – Z33dawg Oct 21 '19 at 15:11
  • Doing this helps contributor's give a better answer to your situation. It also helps others that are facing a similar problem use this as a resource. (sorry to preach :) ) – Z33dawg Oct 21 '19 at 15:14

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.