IC2 not recognizing dynamic Fieldset in apex code(Salesforce)

Issue #888 resolved
Shalini Mendu created an issue

I have the following line in my code: SObjectType.Payee__c.FieldSets.PAYG.getFields()

I am trying to find the fieldset named 'PAYG' on Payee__c object but the inspector shows it as an error 'can not resolve symbol PAYG'. Same is the case with recognizing 'ApexPages.Severity.ERROR' . It shows that Severity is not reconizable.

I switched back to maven's mate as I didn't want to spend time finding out a solution for this issue. Please help. I am on IntelliJ-Community edition with IC2 plugin for force.com

Comments (11)

  1. Scott Wells repo owner

    Shalini, what you're seeing is a first and foremost a bug in IC where it doesn't inject references to field sets in Apex. It does in Visualforce and Lightning...just not Apex. That's an oversight. However, it should be resolving ApexPages.Severity.ERROR. Here's what it looks like on mine:

    ApexPages_Severity_ERROR.png

    Can you verify that your offline symbol table has been properly generated? That's where that symbol is stored.

    As far as the error highlighting that you're seeing around the field set reference, that's a false negative from the unresolvable reference code inspection. I'll use this bug to track the resolution of that bug. I'm trying to resolve all code inspection false negatives in short order as they're reported. In the interim you can either disable that inspection entirely or just suppress it for that specific reference until I release a fix. To do that just use place the input caret on the error and press Alt+Enter (Windows/Linux) or Opt+Enter (Mac), press the cursor-right key, and you'll see various options to suppress the error. Then you can keep an eye on this issue for the fix.

    Thanks for reporting!

  2. Scott Wells repo owner

    Hi, Shalani. I started to debug the field sets aspect of this and found that I have already implemented support for it, e.g.:

    ApexFieldSets.png

    As shown in the screenshot above, it does resolve field sets against the local .object files, so you'll need to make sure that you've pulled down the custom object metadata with the field sets included. Please let me know if you see the same issue after ensuring that the field set metadata is available locally for IC to use.

  3. Scott Wells repo owner

    Resolving for now, but if you do find that it's not working for you after following the instructions in the last comment, please reopen with details about how you have things configured and I'll take another look.

  4. Shalini Mendu reporter
    • changed status to open

    Scott, I am still gettting used to IC2 as I am new to it but I am unable to add FieldSet and pull it down to my system. I added it to the metadata and tried to refresh it but no avail. Seems so basics, but I am stuck, can you help me with it please

  5. Scott Wells repo owner

    Shalina, try using Retrieve Metadata instead of Refresh Metadata. You can read about the differences between the two operations here:

    http://www.illuminatedcloud.com/home/deployment

    but the short version is that when you need to pull metadata you don't already have, use Retrieve, and when you just want the latest-and-greatest version of metadata you do already have, use Refresh.

    Let me know if that doesn't get you there.

  6. Shalini Mendu reporter

    I have done it multiple times after reading through the docs. I might delete the current workspace and start afresh.

    Pls see the screenshots for what I was trying so far: Capture11.JPG Capture12.JPG

  7. Scott Wells repo owner

    Ah. Change the Contents drop-down from Context to Module. Again, it's limited by things you already have locally. You should see an entry in the retrieval window for objects and under that FieldSets, e.g.:

    RetrieveFieldSets.png

    You might also try clicking the Refresh toolbar button (the left-most one) in the retrieval dialog to make sure it has the absolute latest list of metadata from your org.

  8. Shalini Mendu reporter

    I tried it but it displays all the components except the component of my interest(Fieldset) Capture14.JPG

  9. Scott Wells repo owner

    FieldSet is a child metadata type of CustomObject. Scroll down to objects in that list and expand it, then look for FieldSets under that. The screenshot I attached in my last posting shows the relationship. If it's not there, please post a screenshot of the expanded objects node in the retrieval dialog checkbox tree.

  10. Log in to comment