• dinesh kumar 2257
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    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 !

 

I am hoping this is an easy question:

I am invoking an "action" when a visualforce web page is loaded.


    <apex:page contentType="text/xml" controller="MyPageController" action="{!MyUpsertAction}" showHeader="false">


From extensive tracing and debugging, I know MyPageController is working and MyUpsertAction is working
up until the moment it tries to do an "upsert".

I can't figure out how to allow DML operations initiated through a web/visualforce page.

I get the dreaded "Authorization Required" page displayed (instead of the XML my page should be serving up).

I also get an error message sent by email.

    Apex script unhandled exception by user/organization: 005A0000000IePu/00DA0000000Jcjx

    Visualforce Page: /

    caused by: System.Exception: DML currently not allowed


I am sure there is a quick fix by clicking some option somewhere on Saleseforce,
but I am really pulling my hair out trying to find it!


Please be specific about the steps I need to follow to solve this problem.

I am new to developing on Salesforce, so if you just say "enable DML for the site",

I won't have a clue where to navigate and click on the Salesforce web pages.

 

Any suggestions would be appreciated.

David Jones

dxjones@gmail.com