0

We have a Top Case Rank picklist numbers 1-10. We also have many accounts. I'm wanting a way to limit how many top cases each account has.

Account A
Case A Rank 3
Case B Rank 1
Case C Rank 2
Case D Rank 1

I don't want them to have 2 cases Ranked at #1. I would also like upon save that the error says "Case (case number) is already ranked at #1 for this account, please choose a different rank"

How can I make this possible?

1
  • 1
    What have you tried? Where are you stuck? This should be achievable in either Apex or Flow.
    – David Reed
    Commented Feb 2, 2021 at 16:53

1 Answer 1

1

Option 1. You can achieve most of the functionality with only point and click configuration as follows:

  • You can create a Unique External Id field which is the concatenation of the AccountId + Rank.
  • This external id you need to generate with a Workflow/Flow/Process builder.

How this would work: In the example you provided assuming the Accound Id for Account A= '001abc' (not adding 18 digits for simplicity) the External Id field for Case B will be '001abc1'.

When somebody tries to insert Case D, the External Id will be eventually the same and the system will give you an error like the following

enter image description here

This option does most of the job but doesn't give you many details regarding the conflicting record. Hint: the user can use this id, paste it accordingly to the url and navigate to the conflicting record

Option 2. Build a custom solution with triggers and an error message which will provide more details to the user

I would go for Option 1 which does not require custom code, is simple to configure and delivers the main requirement.

1
  • Thank you @ManSpan! I will try option 1 sounds easier!
    – staci
    Commented Feb 2, 2021 at 21:47

Not the answer you're looking for? Browse other questions tagged .