+ Start a Discussion
salvatoreovlassalvatoreovlas 

Empty queries returning all the values

Hi all,

if I put the Id of an object to a variable and then use that variable to query another object with another lookup I get that if by chance the first variable is empty the result will be some random value from the database.

So How to prevent this happening? any Ideas?

Ciao.

Best Answer chosen by Admin (Salesforce Developers) 
RajaramRajaram

Make your filter to include id not equals $GlobalConstant.emptyString that will ensure the record lookup will result in no records found (false status).

All Answers

RKDTRKDT

[Post Deleted]

salvatoreovlassalvatoreovlas

Thank you RKDT,

yeah that's a possible solution and I thought about it too to be honest , but I'm still wondering how to use the global constant empty string properly to do that as well as it could be simpler.

Eventually another possible solution I found is to use a formula which calculates the length of the string and then compare that value if equals to zero in a decision step.....but still dont understand how to use the $GlobalConstant.EmptyString (assign it to a text variable) and to compare that one to the variable I need!

what do u think about it?

RajaramRajaram

Make your filter to include id not equals $GlobalConstant.emptyString that will ensure the record lookup will result in no records found (false status).

This was selected as the best answer
salvatoreovlassalvatoreovlas

Thank you Rajaram!!!!

Didnt think about it and that's the simplest solution!!!U' re great!!!