+ Start a Discussion
knbrloknbrlo 

SOQL Query all cases in an org to see if a value exists?

Is there a way to query all cases in an org using SOQL to see if there is a case with a specific order number particular to our business that has been submitted already?
TylerBrooksTylerBrooks
Ken,

Try the below query:

[Select Id, CaseNumber, Order_Number_Field__c from Case Where Order_Number_Field__c = value]

That should query all cases in your org and then just replace Order_Number_Field__c with the API name of your field and then replace value with the value you're looking for and it will return any records that meet that criteria. Or return no records if it doesn't exist.

Regards, 

Tyler