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
Carlos CiceroCarlos Cicero 

Invalid id error when recieved as parameter

Hi Everyone,

I am getting the error Invalid ID aHS5C000000KykJWAS, but it seems to be only when received as paramenter from Auracomponent.
I check the data type in javascript and it is a String.

 public static void sendEmail( String whatId ) {
      Id what_Id = Id.valueOf(whatId); //This does't work for my custom                                                           object only
      Id what_Id = Id.valueOf('aHS5C000000KykJWAS'); //This work for                                                                                          my custom object


I have tried in serveral ways, but it make no sense. Let me know if you know what is going on.

Thanks,
Carlos

 
SwethaSwetha (Salesforce Developers) 
HI Carlos,
Your ask seems similar to https://salesforce.stackexchange.com/questions/286035/first-exception-on-row-0-first-error-invalid-id-field-invalid-entity-type-for

Try mail.setSaveAsActivity(false); 

If this information helps, please mark the answer as best. Thank you