You need to sign in to do that
Don't have an account?
naypers rtf
Simple Question About Dynamic Query
Hi, I'd like to know how I can to insert this filter in the query, without Security problems. thank you
public Opportunity[] getMyObjectOpportunities() { List<Opportunity> itemsOpportunities; String filter = ' order by ' + columnName + ' ' + sortDirection; itemsOpportunities = [ SELECT o.Name, o.stageName, o.closeDate, o.Id, o.Probability FROM Opportunity o WHERE CreatedById =: getUserId() /* ADD "filter" */ ]; return itemsOpportunities ; }
you will have to do it like this: