You need to sign in to do that
Don't have an account?
Ranu Jain
system limit Exception
Hii
The below code is written in a controller
it this code i am getting an Exception : system limit Exception : to may DML statements
i am not able to get this ...i haven't write nay DML in loop........
and if there is an exception , why code is not going to catch statements.....the debug is not showing in debug lig which i written in catch statements
here is the code :
public PageReference saveProfilePic() { system.debug('EEEEEEEEE'+'in saveProfilePic function'); //Contact to update List<Contact> conToUpdate = new List<Contact>() ; conToUpdate = [select id,ranu__StoreImageUrl__c from contact where id =: contactId] ; //Inserting image parth if(conToUpdate.size() > 0) { conToUpdate[0].ranu__StoreImageUrl__c = 'https://c.ap1.content.force.com/servlet/servlet.FileDownload?file=' + selectedImage; try { update conToUpdate[0] ; } catch(Exception e) { system.debug('CCCCCCCCCC'); ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,e.getMessage())); } } return null ; }
Do you have any trigger , workflow tc also on Contact object.
Plz share the debug logs
no there isno trigger or workflow...
here i am sharing debug log
look at ******* CLose To Limit . i think u can grab the problem here
Thnaks
HI,
I think we can solve this by using this
if(limits.getDMLStatements()== limits.getLimitDMLStatements())
{
//throw exception
}
Hi Renu,
as you can see issue is in the logs
There is no DMLstatement limits and you are trying ti execute 1 DML statement
yes u are right.... but just not understanding ...why there is no DMl limit..
simply we write DMLs in controller function ....
why this exception is here ......i tried this type of functionality. many time.:(
Do your profile has all access on Contact object? your controller is with sharing or without sharing?
Could it be that your method is called from another method that has the @ReadOnly annotation? Inside those marked methods you have higher query governor limits, but can't perform any DML operation (that's why it is called READonly :) ).