Dynamic SOQL:
List<sObject> sobjList = Database.queryWithBinds(string, bindVariablesMap, accessLevel);
Access Level:
- In USER_MODE the object permissions and field level security along with sharing rule of logged in user is enforced.
- in SYSTEM_MODE the object permissions and field level security of the logged in user are ignored.
Map<string,Object> queryBindMap = new Map<string,Object>{'accName' =>'SFDC Account','Industry'=>'Communication'};
string str = 'SELECT ID,Name,Industry FROM Account WHERE Name=:accName'; List<Sobject> sobjectList = Database.QueryWithBinds(str,queryBindMap,AccessLevel.USER_MODE); System.debug('sobjectList::'+sobjectList);
No comments:
Post a Comment