• sunil puchakatla
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I edited my class and saved it successfully but when I accessed my page which uses the class, I get an error of
DML currently not allowed
An unexpected error has occurred. Your development organization has been notified.

controller
public class DefinitionController {

    public DefinitionController() {
            this.DefTable();
    }

  public void DefTable(){
    listplatforms = [select Name,Status__c from Platform__c];

      for(Platform__c idlistplatforms : [select Id from Platform__c]){
        List<Def__c> existplatforms = [select Platform__c from Def__c where Platform__c=:idlistplatforms.Id];

            if(existplatforms.size() > 0)
            {
                idlistplatforms.Status__c = 'Set';
                //update idlistplatforms;
                System.debug('Found'+ idlistplatforms);
            } 
            else 
            {
                idlistplatforms.Status__c = 'Not Set';
                //update idlistplatforms;
                System.debug('Not Found'+ idlistplatforms);
            }
            update idlistplatforms;
      }
  }
    
}
I think the problem is because of the update part. How do I overcome this error?

Thanks in advance !