Deleting en masse from local project, not from org

12 views
Skip to first unread message

Eric Kintzer

unread,
Jan 17, 2025, 8:02:15 AMJan 17
to Illuminated Cloud Q&A

Scott

For whatever reasons, my local project is out-of-sync with its connected org metadata.  (no VCS here in this question)

Example: 

The org removed classes A, B, C but the project still has local files for A, B, C

If I go to the Metadata Delete option as described in the doc, I can see there are all sorts of ways to use the project as a source to delete from the org but it is not obvious how to just delete en masse from the project

package.xml for the project uses wildcard * for type ApexClass

The screenshot shows which classes are Local only (and the ones I want to delete from the project) but you can't check the boxes to Delete.

I realize I could go into the Project view and multi-select, then right mouse button Delete but this is inconvenient (lots of scrolling) and wondering if there's a faster way?  I'm sure I'm missing something obvious here.

Eric







Screenshot 2025-01-16 180207.png

Scott

unread,
Jan 17, 2025, 8:11:30 AMJan 17
to Illuminated Cloud Q&A, crop...@gmail.com
Eric, if it's a source-tracked project, the CLI's source tracking should take care of it. For a non-source-tracked project like you're describing here, the easiest way is to use IC's Retrieve Metadata action configured as follows:

Retrieve_Server_Only.png

Notice that it's configured so only server-only metadata will be included. This will work well for wildcard metadata types and if orphaned metadata is included in your subscription, but if not, you may also need to uncheck Subscribed Only and perhaps change Contents to Custom. Finally click Retrieve for Merge so that you get the diff tool for reconciling differences.

Once the retrieve has completed, you can use the IDE's directory diff tool as follows:

Delete_Orphaned_Project_Files.png

Notice that it's filtered to show only files that exist exclusively in the project and weren't included in the renewal (the blue right arrow and equals are disabled, and the green left arrow is enabled). That will show you "orphaned" project files which you can then select. Once selected, right-click and choose Set Delete, then finally click Synchronize Selected (the old-school play button) and all of the selected local files will be deleted.

To perform a full project/org synchronization via the project's configured metadata subscription, basically do a full Retrieve for Merge, carefully merge files that are present in both the org and the project, add org-only files that were retrieved, remove files that are present only locally, and afterward use Deploy Modified Metadata to update the org with the project's reconciled state.

Hope that helps! Let me know if you have other questions.

Regards,
Scott Wells

Scott

unread,
Jan 17, 2025, 8:14:42 AMJan 17
to Illuminated Cloud Q&A, Scott, crop...@gmail.com
It's also worth mentioning that while the process described above uses the IDE's native diff tool, the IDE supports registration of an external diff tool. I personally use Beyond Compare and find that it provides a much more focused and useful view differences for both directories and files. But certainly the internal diff tool works well for this use case. I just wanted to mention that if you find it to be lacking or cumbersome, you can always use your favorite external diff tool to improve these types of processes.

Regards,
Scott Wells
Reply all
Reply to author
Forward
0 new messages