7

Every now and then when trying to delete something I get the "referenced elsewhere in salesforce.com. Remove the usage and try again" message. And it incorrectly lists a bunch of resources (pages, classes, etc.) which does NOT have any reference to it. So far the only way I am able to get it to work is to go to every resource it lists and just re-save them one by one.

This time again I am trying to delete a static resource and its again showing me a list of pages which does not have any reference to it. Has anyone across this? is there any other easier way to deal with this?

enter image description here

UPDATE: The salesforce developer support have confirmed that this is a recompile issue and currently the only way around this is to save all those pages back to the server to cause a recompile.

5
  • Did these pages have a reference to the item you are trying to delete in the past? Or are they completely spurious matches? Commented Oct 15, 2012 at 9:56
  • Yes, but not directly, all of those pages above use a template. The template page had a reference to the static resource in the past.
    – manubkk
    Commented Oct 15, 2012 at 9:59
  • I have experienced this issue as well, In my case it was a visualforce component. I had to remove the component from each visualforce page Commented Oct 15, 2012 at 10:05
  • Could these be it the trash can? If so - empty it first
    – Saariko
    Commented Oct 15, 2012 at 10:14
  • @Saariko no, the template wasn't deleted, just edited.
    – manubkk
    Commented Oct 15, 2012 at 11:33

3 Answers 3

6

Answering my own question, the way around this is to save all those pages back to the server. But the code won't recompile if there is no change in the code.

The most obvious way to change the code is to add an extra space character somewhere in your source but this would unnecessarily modify the page and include it as a changed file when you deploy to Production or other Sandbox.

To avoid this, the easiest way is to use the IDE's search and replace, search for all "<apex:page" and replace it with "<apex:page " (please not the space in the end). Then select all the pages and save it to server. This would cause the page to recompile but salesforce would force it back to original (without the space) since it does not allow extra space characters between apex page attributes.

2
  • 1
    you're a fucking genius <3 thanks man! the year is 2023.. and we're still facing this issue ROFL
    – DVNube
    Commented Nov 10, 2023 at 6:24
  • @DVNube oh wow, can't believe the issue still exists, but glad it is still helping someone after 11 years!
    – manubkk
    Commented Nov 11, 2023 at 3:23
2

I have experienced this before, but had never looked into it in detail. The template aspect is interesting, as it dovetails with something I've noticed elsewhere in Visualforce. It looked like there was a 'compiled' version of the Visualforce page that had the various templates, components etc applied, presumably for caching purposes. If I changed a component that was embedded into a page, I sometimes had to resave the parent page by adding and removing a single space character. This then pulled the updated component information in.

The only other thing I can think of to try is accessing the rendered Visualforce page and carrying out a hard refresh - I recall having some success with this in the scenario I've described above, but I don't think I've ever tried it in your situation.

3
  • I gave the hard refresh a try but no luck. To me it seems there is some dependency reference which SF maintains internally that needs to be synched.
    – manubkk
    Commented Oct 15, 2012 at 11:39
  • 1
    That was my view too. This makes sense to me in terms of java server pages, in that the markup gets compiled to bytecode which is then cached and sometimes the dependencies don't cause a recompile. Of course this assumes that Visualforce uses JSP (or similar) in some way, and I'm basing this assumption on some of the exceptions I've seen in the past. Commented Oct 15, 2012 at 11:48
  • You were right regarding the recompile
    – manubkk
    Commented Nov 12, 2012 at 4:25
0

Search for what you are trying to delete using the Force.com IDE, this should bring up any pages/classes, triggers, etc, that are referencing that specific component.

2
  • Refresh the eclipse .Say CTRL+H as @pepeFloyd said and search and you can delete at a shot.Please ensure that you are sure to delete those then delete Commented Oct 15, 2012 at 9:54
  • As I already said, it has no references, the search returns nothing.
    – manubkk
    Commented Oct 15, 2012 at 9:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .