MyCustomObject__Share not found when editing code - If Historical Trending is enabled for a field

Issue #1831 resolved
Eric Kellstrand created an issue

Win10 Enterprise 20H2 running both

  • IntelliJ IDEA (build #IC-203.7148.57, 25 Jan 2021 21:24)

  • WebStorm 2020.3.1 Build #WS-203.6682.155

I have a problem with the IDE recognizing MyInnocentObject__Share objects for just 1 of my custom objects. I believe I tracked this down to a root cause of the MyInnocentObject has a field called Devil_Field which has Historical Trending enabled on it.

Steps:

  1. Create Custom Object MyInnocentObject
  2. Enable sharing for MyInnocentObject
  3. Add field "Devil_Field" to MyInnocentObject
  4. In Salesforce, Naviate to Setup -> Analytics -> Reports & Dashboards -> Historical Trending
  5. Enable Historical Trending for Devil_Field
  6. In IntelliJ, create a retrieve a project with MyInnocentObject
  7. Recreate the OST
  8. Create an Apex Class/Method with anything that references MyInnocentObject__Share - "MyInnocentObject__Share myObj;" is enough
  9. Confirm Error

    1. Expected: IDE does not complain about the line. eg no red squiggly lines, etc.
    2. Actual: IDE does not recognize MyInnocentObject__Share and thus shows you the red squigglies.
  10. Look at OST zip file. Confirm that MyInnocentObject__Share.cls exists

  11. Notice the zip also contains /MyInnocentObject/c_hd.cls
  12. Delete /MyInnocentObject from OST zip (Just the directory, not the class files in the root)
  13. In IntelliJ, File -> Invalidate Caches and restart
  14. Open test class and notice MyInnocentObject__Share is recognized and the squigglies are gone

Comments (2)

  1. Scott Wells repo owner

    Thanks for filing, Eric, and especially for the detailed steps to reproduce. I'm right in the middle of a significant change right now but will queue this up for investigation after I wrap up that work. I'll keep you posted as I try to reproduce it myself.

  2. Scott Wells repo owner

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

  3. Log in to comment