You need to sign in to do that
Don't have an account?
Board salesforce
where clause for the dynamic search in fieldsets
Hi all,
can any one help on this .
in this method am not able to get the product values in search functionality
can any one help on this .
public pageReference searchProducts(){ Map<String,Object> fieldValuesMap =new Map<String,Object> (); String query = 'select id'; System.debug('query first ------>'+query ); string WhereClause; for(Schema.FieldSetMember f : SObjectType.Product2.FieldSets.SearchProducts.getFields()) { query += ', ' + f.getFieldPath(); WhereClause=''+schema.product2.getSobjectType()+' LIKE \'%'+ f.getFieldPath() + '%\' '; System.debug('WhereClause ------>'+WhereClause ); } query += ' FROM Product2 WHERE ' +WhereClause; System.debug('query ------>'+query ); Products = Database.query(query); System.debug('Products ------>'+Products ); for(Schema.FieldSetMember f : SObjectType.Product2.FieldSets.ProductFields.getFields()) { WhereClause='id=:Product2.id ,Product2.'+f.getfieldPath()+' LIKE \'%'+ f.getFieldPath() + '%\' '; System.debug('WhereClause ------>'+WhereClause ); } WhereClause += ' FROM Product2 WHERE ' +WhereClause; System.debug('query ------>'+query ); Products = Database.query(query); System.debug('Products $$$$$ ------>'+Products ); query=Query +'From Product2'+WhereClause; System.debug('query $$$$$ ------>'+query ); return Null; }
in this method am not able to get the product values in search functionality
Try below code it will help you, Please let me know, if you have any question,
BestRegards,
Dayakar.D