Attachment Schema Missing from Offline Symbol Table

Issue #2077 resolved
Aaron Mattson created an issue

The Attachment object doesn’t seem to be created when generating the Offline Symbol Table. This presents itself in a few different ways:

  • Missing an entry in the Schema folder of the Offline Symbol Table
  • Unavailable in the list of SObject Types when trying to create an Apex Trigger
  • Numerous Inspection Warnings when reviewing existing Attachment-related code

This feels like it might have something to do with my org or IntelliJ/Illuminated Cloud 2 settings, but can you validate?

This should be valid code, to replicate the third issue:

trigger AttachmentTrigger on Attachment (after insert) {}

Comments (6)

  1. Scott Wells repo owner

    Hi. I'm seeing that SObject in all of my OSTs, e.g.:

    global class /*Schema.*/Attachment extends SObject 
    {
        global Blob Body;
        global Integer BodyLength;
        global String ContentType;
        global FlowExecutionErrorEvent ContextRecord;
        global User CreatedBy;
        global Id CreatedById;
        global Datetime CreatedDate;
        global String Description;
        global static final SObjectTypeFields fields;
        global Boolean IsDeleted;
        global Boolean IsPrivate;
        global User LastModifiedBy;
        global Id LastModifiedById;
        global Datetime LastModifiedDate;
        global String Name;
        global SObject Owner;
        global Id OwnerId;
        global SObject Parent;
        global Id ParentId;
        global FlowRecordRelation RelatedRecord;
        global static final SObjectType SObjectType;
        global Datetime SystemModstamp;
        global UserRecordAccess UserRecordAccess;
    
        global Attachment()
        {
        }
    }
    

    Can you do the following?

    1. Verify that you're on the latest versions of both IC2 and the underlying JetBrains IDE.
    2. Verify that you're properly authorized in the connected org to be able to read all SObjects. SObjects/fields for which you're not authorized will not end up in a generated OST.
    3. See whether you have a local Apex class called Attachment in the project. That shouldn't matter, but just in case it might be confusing IC2 during OST generation, let's check that.
  2. Aaron Mattson reporter

    That’s interesting (and good to know it might just be my setup)! I guess I can utilize that for the meantime.

    As for your ideas, I can’t find anything glaringly wrong:

    1. IntelliJ IDEA 2021.3.3, Build #IU-213.7172.25, built on March 15, 2022 - that appears to be the latest version of the IDE. Illuminated Cloud 2 plugin is on 2.2.1.4
    2. As far as I can tell, I’m authorized to read all SObjects (or at least the Attachment):

      1. I have the default System Administrator profile.
      2. The Attachment SObject is listed with a Schema.getGlobalDescribe(); OR ((SObject)Type.forName('Schema','Attachment').newInstance()).getSObjectType();
      3. I can run a basic SOQL query for [SELECT Id FROM Attachment]
    3. We don’t have a local Apex class or trigger named “Attachment” specifically, but we do have a plural Attachments.cls, following FFLIb’s naming convention for domain layer classes.

  3. Aaron Mattson reporter

    Started up a new project today on another org and after Illuminated Cloud built the Offline Symbol Table, I looked into Schema and saw Attachment present. This is odd - is there anything else I could look for, in logs or otherwise, to identify why the Attachment SObject might be omitted? The org is ~15 years old and has more than its fair share of metadata, so I wouldn’t be surprised about a timeout, legacy setting, or surpassed threshold.

  4. Scott Wells repo owner

    This is the custom build that I proposed which only tries to generate the OST entry for the Attachment SObject type when you regenerate the OST for SObjects only. Download the archive (but don't extract it) and install it using Settings / Preferences > Plugins > Install plugin from disk (under the gear drop-down menu). After the IDE restarts, make sure you have the following in Help > Diagnostic Tools > Debug Log Settings (you likely should based on what you've already done):

    #com.illuminatedcloud.symtab.OfflineSymbolTable
    #com.illuminatedcloud.symtab.OfflineSymbolTable!trace
    #com.illuminatedcloud.intellij.settings.project.OfflineSymbolTableGenerator
    #com.illuminatedcloud.symtab.SystemDeclarations
    

    Then regenerate the OST choosing the SObjects Only option. Once that completes, grab the debug logs and either attach them here or email them to me, and finally fully regenerate your OST one more time to ensure it's not based on this diagnostic hack.

    I'll be very interested to see what these logs show...

  5. Scott Wells repo owner

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

  6. Log in to comment