+ Start a Discussion
Nisha Babu 8Nisha Babu 8 

Construct query dynamically

Hi

Construct a query dynamically by checking the non-empty field . If a field is not empty then add it to the query for comparison, if the field is empty then just bypass the field.

Suppose : Account is not having stages.
So in custom setting there is a field for stages as well.
So for the account object the field should not be included in the query
CreatedDate<'Comparison date from custom'  AND Amount< $10 and the stages should not be included.
Moreeover the query should be dynamically created by using some map.....
Cannot specify the created date ,instead have to specify by using some map values
How to implement it?

Regards,
   Nisha