Metadata is not refreshing for newly added objects when parent metadata directory is not already present

Issue #367 resolved
jrattanpal created an issue

I started my project with Aura, ApexClasses and Staticresources.

But now I changed settings (Ctrl+Alt+Shift+s) to include a custom object and a tab. But for some reason, IDE is not syncing this new data. I am not sure what I can do. I "retrieved" new metadata and even generated offline symbol table (not sure if it's related).

Is this a bug? Or maybe I missed what I need to do?

Comments (34)

  1. Scott Wells repo owner

    Just so I understand, you updated your explicit subscription selection to include a specific custom object and the associated tab, then went into the retrieve dialog and didn't see those items available for retrieve? Did you click the Refresh button in the retrieve dialog? I don't automatically refresh the metadata in those windows because it's an expensive operation. Please let me know if that doesn't make the new metadata available.

  2. jrattanpal reporter

    Yes, I did retrieve and then refresh button multiple times. I also did "Refresh metadata" in menu item and that didn't work either.

    I had to manually retrieve custom object (using workbench) and add it to "src" directory to get it to work for now.

  3. jrattanpal reporter

    To add, same happened on another project too. And in that second one, I also added PermissionSet and those didn't show up either.

  4. Scott Wells repo owner

    Okay, Refresh Metadata wouldn't bring down new metadata. It's designed to be a fast operation that doesn't need to perform any queries to list metadata, instead refreshing only things that it already knows exist locally. To pull down new metadata you must use Retrieve Metadata.

    I just tried to reproduce this behavior myself using the following steps:

    1. Create a new custom object called "Issue367" and a new custom object tab for that object.
    2. Open the IC subscription, clicked Refresh, and selected "Issue367__c" under CustomObject and under CustomTab. Clicked OK.
    3. Clicked Build>Illuminated Cloud>Retrieve Metadata, configured the window as below, and clicked Refresh in the toolbar. I see "Issue367" under both objects and tabs highlighted as Server Only.

    Issue367.png

    1. Clicked OK to retrieve the metadata, and I see Issue367__c.object and Issue367__c.tab in the comparison window:

    Issue367-2.png

    Issue367-3.png

    Can you verify that these are the same steps you're following?

    Thanks!

  5. jrattanpal reporter

    Ok, it's working now. But it didn't work before.

    Then I realized a difference. I didn't have src/objects directory when I tried the first time. So, to be sure, I deleted src/objects folder. And when I tried above steps, it didn't pull in those selected objects. Not sure why.

    Then I manually added src/objects folder (empty folder), tried above steps and it started showing new objects again.

    But one thing for sure, Even when I see the new objects (when src/objects folder is there), src/package.xml is NOT updated. It means, I can't take that folder and deploy to another instance and will manually need to create package.xml.

    So, 2 bugs here - Objects/other settings not synced if folder is not already there (at least in my case) - package.xml is not updated.

    Let me know if you need any logs/info

  6. Scott Wells repo owner

    Okay, good to know. I'll make sure to fix the bug that occurs when the target parent directory isn't present. As for it not updating package.xml, that's intentional. If you do a selective retrieval, the returned package.xml reflects only those contents and shouldn't be copied directly over a complete package.xml.

  7. jrattanpal reporter

    Thanks Scott.

    And can you clarify about package.xml? I do want the selected package.xml based on my selections on the project. This way, once I have the project ready, I can just take the directory, zip it up along with package.xml which was generated (for selected items) and deploy it to any other org.

    Is there any way to have the system generate package.xml for selected elements?

    Thanks

  8. Scott Wells repo owner

    Right now the returned package.xml is generated by Salesforce based on the requested metadata. That means if you're retrieving a subset of your total subscription (context or custom), the returned package.xml is incomplete relative to that subscription. Originally that was included in the directory diff, but users were wiping out their real package.xml with incomplete package.xml contents from the retrieval, so I now exclude that from the directory diff if you haven't retrieved either module or project. Additionally, the returned file may not look exactly like you want in terms of wildcarding and such (they may be expanded to individual entries).

    I think if you want a package.xml for your current subscription, it would be better to make that a first-class feature where you have more control over the resulting package.xml file in terms of wildcards, etc. Otherwise I'm concerned that it won't be what you want more often than it will be. Feel free to log a separate enhancement for generating a package.xml from a custom metadata selection if you'd like.

  9. jrattanpal reporter

    Understood. Thanks. It's good for now. But if I come across it again and think it's really needed then I'll log a feature request.

    As a side note, you could still add it but maybe callit package_IC.xml. this way, if needed by someone like me then it can be used.

    Anyways, that's a different topic. I mainly wanted to log that Retrieve bug.

    Thanks

  10. Scott Wells repo owner

    Hmmm...unfortunately I wasn't able to reproduce the issue by removing the entire, say, tabs folder and performing a retrieve. After a refresh it properly showed the missing tab and retrieved it. I'll keep trying to reproduce it...

  11. Scott Wells repo owner

    I've been unable to reproduce this behavior. I believe that it happened, but I can't reproduce it. I'm going to resolve for now, but if you can provide reliable steps to reproduce, please feel free to reopen and I'll definitely address it.

  12. jrattanpal reporter
    • changed status to open

    Scott,

    This happened again today. Following are all the steps.

    • Project Settings
    • Facets
    • Illumindated Cloud
    • Select a new object (AFTER project has been created)
    • I selected CustomObject and CustomLabels
    • Click Apply
    • Click Illuminated Cloud -> Retrieve Metadata
    • Click Refresh

    Issue: - Newly selected Metadata does NOT show up

    Solution: - Go to project - Create src/objects folder - Click Illuminated Cloud -> Retrieve Metadata - Click Refresh

    Success: - New metadata shows up, can be selected and downloaded - Do the same for "labels"

  13. Scott Wells repo owner

    Okay. Let me take another look. Hopefully these detailed steps will allow me to reproduce it and fix it.

  14. Scott Wells repo owner

    I apologize but I'm still not able to reproduce this. Here's what I did:

    1. Create a brand new project with a subscription for classes, triggers, pages, components, static resources, and Lightning bundles (basically the default for new projects).
    2. The new project wizard completed, metadata was retrieved, and the OST was generated
    3. Started a retrieve operation.
    4. Clicked the pencil icon beside Contents to edit my subscription.
    5. Added custom labels and a subset of custom objects (just three truly custom objects) and clicked OK.
    6. Upon being returned to the retrieve dialog, I'm able to see the custom label/object metadata that I just added to my subscription as being server-only and part of the subscription. I do not have folders for either of these in my local source root yet.
    7. Clicked OK to retrieve the metadata and, when the directory diff was displayed, the new metadata was included. I copied it into my local source root successfully.

    Then to try to more closely follow your steps, I did the following in the same project:

    1. Create a brand new custom application in my org.
    2. Open the project structure settings and went to the Illuminated Cloud facet for my module.
    3. Verified that the new custom application was not initially listed in the Selected tree under CustomApplication.
    4. Clicked Refresh, verified that the new custom application was now properly available for selection, added it to my selection, and clicked OK.
    5. Started a retrieve operation and set the contents to Module. Initially the custom application was not listed in the tree.
    6. Clicked Refresh and verified that the new custom application was available in the tree and selected for retrieval.
    7. Clicked *OK to perform the retrieval.
    8. When the directory diff is display, the new custom application was included and I copied it it into my local source root.

    Is it possible you missed the first refresh in the subscription editor to pick up the newly-created metadata? I cache the list of metadata from the org aggressively, so when new metadata is created in the org, you have to refresh your subscription or IC won't know about it.

    Please let me know whether these steps don't work consistently for you.

  15. jrattanpal reporter

    Ah, I see the difference and wonder if that might be it.

    • I do NOT change subscription from Contents.

    • I go back to File->Project Structure->Facets->Illuminated Cloud

    • Change "Selected" Metadata
    • Apply

    • Then retrieve metadata

    • Click refresh

    But new objects don't show up.

  16. Scott Wells repo owner

    Comment conveyed from #444:

    This happened again. This time I am using Mac.

    • Create project
    • Sync metadata
    • Go to org and create a custom setting
    • Go to File->project and change subscription to include that "Custom Object" (custom setting)
    • Now go to project and retrieve metadata

    But new object does NOT show up

    • Go to actual directory where project is created
    • Create src/objects folder
    • Run "Retrieve Metadata" option again (without changing any other subscription etc)

    New object shows up.

    Log file is attached.

  17. Idan Eshel

    Hi - thanks for the great plugin Scott.

    I had this issue today and wasted 3 hours and zillion tries till it somehow worked.

    TA

  18. Scott Wells repo owner

    I have this on my near-term TODO list (likely for the next or next-next patch). If I'm unable to reproduce it again, I'll let you know so that hopefully you can provide additional steps to reproduce. So odd that a reasonable number of people have seen this and I haven't been able to reproduce it...

  19. Scott Wells repo owner

    Is this still happening for you guys? If so, any new thoughts on how to reproduce it? I've tried several times, always unsuccessfully.

  20. Idan Eshel

    Hi @RoseSilverSoftware - thanks for the follow up. I'm not sure if this is the exact issue I had but maybe my current issue is linked to this directly.

    I've "Retrieve Metadata" and can see the class in the project view, but it is not showing when CTRL+SHIFT+N [search for files]. I've since refresh and close/open intelij without luck.

    1. Is this relevant?
    2. What the remedy?

    Many thanks for this tool. :)

  21. Scott Wells repo owner

    Idan, which metadata in particular isn't showing up? Anything that's not working properly is certainly relevant, but what you've described is likely a different issue. If you can provide me with details I'll definitely take a look and see what's happening

  22. Scott Wells repo owner

    I think this should actually be fixed finally in 2.0.4.3 and 1.8.4.2. Let me know if anyone still sees an occurrence of this.

  23. Log in to comment