I have an <apex:component>
that is tied to a VF email template. I am assigning the AccountId as the attribute. The issue now is that when I try to do a field update in the Account record (DML) in getter method, I get an error.
<apex:component controller="AccountController" access="global" allowDML="true">
<apex:attribute name="accountId" assignTo="{!accountId}" type="String" description="Id of the account object"/>
Apex Class:
Setter:
public void setRecipientName(String accountId) {
accountInfoId = accountId;
}
Getter: I am trying to do a DML here and as per the documentation, it is not allowed.
public User getRecipientName(){
// Here I am updating the field account status to the value based on the approval process instance step status.
}
I looked into this post but it's not helpful. Can you perform DML operations from visualforce email templates?
Is there any other workaround?