[SalesForce] Why does it say the VisualForce page ‘does not exist or is not a valid override for action Edit?’ It exists and is valid!

I am developing a managed package that has a VisualForce page for configuration. Before I packaged everything up, I made some buttons on the page that the user can click to automatically set their org's Account 'New' and 'Edit' action overrides to be of type 'Visualforce' and point to custom VF pages that are in the same namespace. This is done using the metadata api via JSforce.

The connection is set up in a JS script on the configuration VF page like so:

var conn = new jsforce.Connection({ accessToken: "{!$Api.Session_Id}"});

The thing is, everything worked fine until I added everything into a managed package (including the custom VF pages that the action overrides are supposed to point to. Now when I click the button to automatically set the overrides, I get an error that says,

namespace__page_name does not exist or is not a valid override for action Edit

I know the page exists and is a valid override, because I can set the override manually.

I did notice that in the error it had the page's name all lower case, whereas I sent it more like NameSpace__Page_name, so maybe SalesForce suddenly started being case-sensitive and JSforce suddenly started converting requests to all lowercase…but I doubt it.

Why can't it find the page anymore? I'm testing this in the same org I'm developing it in (still waiting for my Partner account)…could that be a factor?

Best Answer

You should install it into a staging Org to conduct meaningful tests.

My experience is, that in managed packages you'll get a way less powerfull session-id, so your {!$Api.Session_Id} could be a reason.

Find some backgrounds for session Ids here:

Related Topic