1

I'm using a flow to create a new record, and based on a field called "program" it is assigning the record type. I've hit the character limit in my first formula so I am trying to nest my formulas together but can't get the syntax right.

I created a formula resource: CalculateAppReviewType

CASE({!Application.TargetX_SRMb__Program__c},
 
"Nursing-Associate Degree", "a1a1U0000008D6tQAE",
"Nursing Assistant", "a1a1U0000008D6tQAE",
"Practical Nursing", "a1a1U0000008D6tQAE",
  
"Child Care Services", "a1a1U0000008D78QAE",....) 

I just included a snippet, but it goes on. I still have some values:

"Environmental Engineering – Waste & Water Technology", "a1a1U0000008D7IQAU",
"Energy Management Technology", "a1a1U0000008D7IQAU"

that need to be added but I've hit the character limit. Can/How do I write the 2nd formula to nest the CalculateAppReviewType to be used in the flow?

3
  • 2
    You can use Custom Metadata to maintain a "lookup table" of program names and record types. Then in the Flow, you can select the custom metadata record by program name, get the record type ID, and you don't need any IF or CASE testing. See Trailhead. Mar 29 '21 at 17:47
  • 1
    adding to david, the Custom MDT should map the program name to the recordtype developername and then the Flow can query the RecordType sobject to look up the Id. Don't put the ids in the MDT - a maintenance nightmare.
    – cropredy
    Mar 29 '21 at 22:55
  • Yeah, avoid hard-coded ids like the plague :-) Mar 30 '21 at 2:11
1

welcome!

Formula limits stack, unfortunately. This means that when evaluating the total character limit of a formula, Salesforce will include the logic from the formula at hand, together with any and all formula fields that it depends on. Their total character limit combined needs to be less than the 5,000ish limit.

This basically means you need to use something other than a formula to manage the mapping from program to record type id. I've become a fan of custom metadata for this purpose. I've always used it in the context of apex, but it looks like you can use it in the context of a flow:

https://trailhead.salesforce.com/en/content/learn/modules/custom_metadata_types_dec/cmt_flows

Another, simpler option that I've often considered trying (but never have) is to use multiple workflow rules that store the record type id in a text field. Put half of the case values in one, and half in the other. When the program field changes, run both rules. Whichever one matches the program value performs a field update. In that field update, you run a CASE statement to determine the appropriate record type id.

Hope that helps!

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.