Posts

Showing posts from July, 2014

apex object userRecordAccess not returning any row

userRecordAccess not returning any row Salesforce has launched new object ' userRecordAccess ' which provides the information that whether an user has access to a particular record. SELECT RecordId, HasEditAccess FROM UserRecordAccess WHERE userId = '0053232192...' AND RecordId = '001*****' However when I tried to use the same in my code, there were some issues. If you run the above query in the anonymous or developer console you get proper result. However the same query when embeded into the code with user id with some variable and record id from some variable. then the same query doesn't return any row. Although I found that the above problem resolves if same query is fired through dynamic query call. i.e. Database.execute( query ). Weird but it solve the purpose.

Too many batch retries in the presence of Apex triggers and partial failures.

Too many batch retries in the presence of Apex triggers and partial failures If you write and execute batch scripts then some time you might end up with this error, which may be difficult to understand. However proper explanation is given in the Salesforce documentation as below. Bulk DML Exception Handling Exceptions that arise from a bulk DML call (including any recursive DML operations in triggers that are fired as a direct result of the call) are handled differently depending on where the original call came from: When errors occur because of a bulk DML call that originates directly from the  Apex  DML statements, or if the  all_or_none  parameter of a database DML method was specified as true, the runtime engine follows the “all or nothing” rule: during a single operation, all records must be updated successfully or the entire operation rolls back to the point immediately preceding the DML statement. When errors occur because of a bulk DML call that ...