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
Haseeb Ahmad 9Haseeb Ahmad 9 

how to stop creating case if opportunity already have one open case?

Hello,

Case object have lookup relation to opportunity (OppToCase__c) what I want if an opportunity already has an open case with record type ('PS Only') related,  then don't let user create another case with that same record type.

How I will do that? any idea?  thank you
PriyaPriya (Salesforce Developers) 

Hi Haseeb,

You may try it with validation rules. Create a validation rule on child objcet with below formula:
If( OR( ISPICKVAL( <yourfieldname>, "open" ),
),
ISNEW(),
false
)

Please mark it as Best Answer so that it can help others in the future.

Regards,

Priya Ranjan