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
abivenkatabivenkat 

DML operation UPDATE not allowed on Email Message - issue in Trigger

 

hi all,

 

In my scenario, i have to query the subject field from Email Message object and make some changes and update those changes back to get effect. while doing this, i am getting the error as 

 

DML operation UPDATE not allowed in Email Message

 

how can i update the Subject field in the Email Message object? 

 

 

thanks

abivenkat

SFDC Learner

Best Answer chosen by Admin (Salesforce Developers) 
*werewolf**werewolf*

The EmailMessage object is not updateable.  Your only option is to delete it and add a new one if you need to edit it.

All Answers

IspitaIspita

hi,

If one goes by the error it seems you dont have the rights to do that. It seems you are trying to edit the subject of an existing email object which is perhaps not allowed in salesforce.

 

 

abivenkatabivenkat

 

hi ispita,

 

your point of view seems to be having rights to perform, then, who will be permitted to do these in salesforce. i am using sandbox environment, so that, i dont have rights to alter the Email Message object or what?

 

is there any thing we can do to achieve this functionality? 

 

 

thanks,

abivenkat,

SFDC Learner

*werewolf**werewolf*

The EmailMessage object is not updateable.  Your only option is to delete it and add a new one if you need to edit it.

This was selected as the best answer
IspitaIspita

The werewolf is correct .....

As you cannot edit the subject of an email already sent or received ~ that is the business sense behind this ....

abivenkatabivenkat

 

 

i have fixed with another workaround in my issue. i was writing the trigger in my cases object and was trying to update the existing email message which is stored in the emailmessage object. but, instead of doing like that, i wrote the before insert trigger in email message object and fixed the issue. thanks for your replies and guiding me thro the correct way. thank u ispita and werewolf..

 

 

thanks,

abivenkat

SFDC Learner