Messaging.sendEmail can not be resolved

Issue #1929 resolved
Christian Gottlieb created an issue

The Messaging Class has a listed method sendEmail, see here for reference, it actually even supports a non mentioned metod that acceps only one parameter, the List of Emails. Neither is indexed it seems, see attached screenshot.

Workaround: System.Messaging.sendEmail() is recognized and will in some cases be matched to by the Editor automatically.

Comments (8)

  1. Scott Wells repo owner

    Hi. I'm not seeing that issue:

    Issue_1929.png

    What version of the plugin do you have installed, and when is the last time you generated your OST? If not already do, please make sure both are completely up-to-date and let me know if the same issue persists.

  2. Christian Gottlieb reporter

    I actually did the last refresh of the OST right before I wrote this.

    Plugin is in version 2.1.8.1 according to Intellij.

    I have 2 projects on the same org and the same IntelliJ. Both under SFDX. Both OST up to date. One in the standard file configuration (so force-app etc) has no issues. The other has a customized folder structure, there I have this error.

    The OST are located identically though, so projectRoot/IlluminatedCloud/ConnectionName/OST.zip

    Note: Both Projects do not feature the sendEmail class under the Messaging folder, instead they are only located as method in System/Messaging. In the second case, the IDE is looking for the Method in the first folder though.

  3. Scott Wells repo owner

    Christian, I apologize but I'm confused by your statement "Both Projects do not feature the sendEmail class under the Messaging folder, instead they are only located as method in System/Messaging". There are two system classes called Messaging, System.Messaging which should have the sendEmail methods and Component.Messaging which is an inner class of the top-level Component class used for dynamic Visualforce. The former is the relevant one, and here's what it looks like in my generated OST:

    // Generated by Illuminated Cloud on Wed Jun 16 10:38:52 CDT 2021. Do not edit.
    
    global class /*System.*/Messaging 
    {
        global static Messaging.InboundEmail extractInboundEmail(Object source, Boolean includeForwardedAttachments)
        {
        }
    
        global static List<Messaging.RenderEmailTemplateBodyResult> renderEmailTemplate(String whoId, String whatId, List<String> bodies)
        {
        }
    
        global static Messaging.SingleEmailMessage renderStoredEmailTemplate(String templateId, String whoId, String whatId)
        {
        }
    
        global static Messaging.SingleEmailMessage renderStoredEmailTemplate(String templateId, String whoId, String whatId, Object attachmentRetrievalOption)
        {
        }
    
        global static Messaging.SingleEmailMessage renderStoredEmailTemplate(String templateId, String whoId, String whatId, Object attachmentRetrievalOption, Boolean updateEmailTemplateUsage)
        {
        }
    
        global static void reserveMassEmailCapacity(Integer count)
        {
        }
    
        global static void reserveSingleEmailCapacity(Integer count)
        {
        }
    
        global static List<Messaging.SendEmailResult> sendEmail(List<Messaging.Email> emailMessages)
        {
        }
    
        global static List<Messaging.SendEmailResult> sendEmail(List<Messaging.Email> emailMessages, Boolean allOrNothing)
        {
        }
    
        global static List<Messaging.SendEmailResult> sendEmailMessage(List<Id> emailMessagesIds)
        {
        }
    
        global static List<Messaging.SendEmailResult> sendEmailMessage(List<Id> emailMessagesIds, Boolean allOrNothing)
        {
        }
    }
    

    Can you share yours if it's different? Also, do you happen to have a local class named Messaging in your project?

  4. Christian Gottlieb reporter

    My class under System/Messaging is identical. However the faulty project is accessing this structure when it tries to resolve:

    And no local class Messaging. As I said, it is basically the same code base, just a different folder structure.

  5. Scott Wells repo owner

    Ah, I see. You're saying that it's evaluating Messaging as a namespace prefix and not as a type prefix for System.Messaging, right? I wonder why you're seeing that behavior and I'm not....let me play with it a bit and see if I can reproduce it. Thanks for clarifying!

  6. Scott Wells repo owner

    Hi. I'm still unable to reproduce this. Could you create a SUPER simple standalone Apex file that reproduces the behavior for you and provide that? I may even need you to provide the entire containing project in case there's something around how the project is configured. If so, it would just need to be a project with that one Apex class that reproduces the behavior, the OST for that project, and the project config files themselves.

  7. Scott Wells repo owner

    Issue tracker grooming. If this is still an issue, please feel free to reopen, ideally with a concrete reproduction scenario.

  8. Log in to comment