function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
lopezclopezc 

System.Exception: DML currently not allowed ... External entry point

 

Hi,

 

 

I'm trying to create an update  function for a custom object. In my Visualforce code, there's a commandLink to perform the work. When pressing the link I call a method in my controller that updated the record which ID is passed as a parameter. However, it doesn't work and I get the following error:

 

 

 


System.LimitException: DML currently not allowed

 

 

Class.MyRequestsController.approveRequest: line 135, column 3 External entry point

 

here is part of my code:

 

 

<apex:pageBlockTable value="{!currentQueryBatch}" var="query" columns="7" styleClass="query-table">
		            <apex:column headerValue="Request Number"><a href="requestTicket/RequestDetailsView?id={!query.id}"><apex:outputText value="{!query.Name}"/></a></apex:column>
		            <apex:column headerValue="Subject" value="{!query.Subject__c}"/>
		            <apex:column headerValue="Status" value="{!query.Status__c}"/>
		            <apex:column headerValue="Team" value="{!query.Team_Name__c}"/>
		            <apex:column headerValue="Date" value="{!query.CreatedDate}"/>
		            <apex:column headerValue="OwnerId" value="{!query.OwnerId}"/>
		            <apex:column headerValue="Approval Status" value="{!query.Approval_Status__c}" rendered="{!OR(openQueriesDisplayed,closedQueriesDisplayed)}"/>
		            <apex:column rendered="{!approvalQueriesDisplayed}">
                		<apex:facet name="header">Action</apex:facet>
                        	<apex:commandLink value=" Approve " action="{!approveRequest}">
                        	<apex:param name="queryId" assignTo="{!queryId}" value="{!query.Id}" />
                        	</apex:commandLink>
            	            </apex:column>
</apex:pageBlockTable>

 please, help

 

<apex:pageblock id="openqueries">
<apex:pageBlockTable value="{!currentQueryBatch}" var="query" columns="7" styleClass="query-table">
           <apex:column headerValue="Request Number"><a href="requestTicket/RequestDetailsView?id={!query.id}"><apex:outputText value="{!query.Name}"/></a></apex:column>
           <apex:column headerValue="Subject" value="{!query.Subject__c}"/>
           <apex:column headerValue="Status" value="{!query.Status__c}"/>
           <apex:column headerValue="Team" value="{!query.Team_Name__c}"/>
           <apex:column headerValue="Date" value="{!query.CreatedDate}"/>
           <apex:column headerValue="OwnerId" value="{!query.OwnerId}"/>
           <apex:column headerValue="Approval Status" value="{!query.Approval_Status__c}" rendered="{!OR(openQueriesDisplayed,closedQueriesDisplayed)}"/>
           <apex:column rendered="{!approvalQueriesDisplayed}">
                 <apex:facet name="header">Action</apex:facet>
                         <apex:commandLink value=" Approve " action="{!approveRequest}">
                         <apex:param name="queryId" assignTo="{!queryId}" value="{!query.Id}" />
                         </apex:commandLink>
                         <apex:commandLink value=" Reject " action="{!rejectRequest}">
                         <apex:param name="queryId" assignTo="{!queryId}" value="{!query.Id}" />
                         </apex:commandLink>
               </apex:column>
</apex:pageBlockTable>
</apex:pageblock>

 

Best Answer chosen by Admin (Salesforce Developers) 
Abhinav GuptaAbhinav Gupta

Are  you inside a component ?  if yes set allowDML = true