2

I have a script that uses the metadata API to update the 'New' and 'Edit' action overrides for Account so those actions navigate to a couple of custom VisualForce pages.

The script works. I can use setup->customize->Account->Buttons, Links, and Actions to see that the overrides now have the new type, content, and comments, and I can click the New and Edit buttons for Account and they do indeed redirect to my custom pages.

The problem is that when I use readMetadata on Account to programmatically check if the overrides are set, the metadata that is returned says that the type of the Edit actionOverride is 'Default' instead of 'Visualforce'. Why is it lying to me?

2

I have an 'Edit' action override on the OpportunityLineItem to a Visualforce page. This was configured via the UI rather than via the metadata API.

Performing a call to retrieve with a RetrieveRequest containing a PackageTypeMembers with:

  • name = "CustomObject"
  • members = ["OpportunityLineItem"]

Gives a package containing:

package.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>OpportunityLineItem</members>
        <name>CustomObject</name>
    </types>
    <version>34.0</version>
</Package>

objects/OpportunityLineItem.object

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <!-- ... -->
    <actionOverrides>
        <actionName>Delete</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Edit</actionName>
        <comment>Redirect the editing of XYZ to the ABC page.</comment>
        <content>XyzOliEditPageRedirect</content>
        <skipRecordTypeSelect>false</skipRecordTypeSelect>
        <type>Visualforce</type>
    </actionOverrides>
    <!-- ... -->
</CustomObject>

So, in this case it does return the expected ActionOveride via the CustomObject.

Note that the docs for ActionOverrideType states:

default—The override uses a custom override provided by an installed package. If there isn’t one available, the standard Salesforce behavior is used.

So, either:

enter image description here

or, Salesforce is only partially lying to you about the nature of reality and will still find the Visualforce page even if the value is default.

See also:

  • This only seems to happen on OpportunityLineItem Edit. This one override behaves badly every time I try to use the metadata API on it. And it's been that way for years. Someone really should look into it. – sfdcfox Jun 18 '15 at 20:46
  • @sfdcfox So you see default rather than visualforce for the edit actionOverride on OpportunityLineItem? Did you configure yours via the metadata API or via the UI? I'm wondering if it is specific to how it was initially setup. – Daniel Ballinger Jun 18 '15 at 20:51
  • I can't get it to replicate right now, but I think it might be a cross-org deploy problem. We would do deployments where the error would say "unknown override ourpagename" instead of "OurPageName" (in other words, the API lower-cased the page name in the action override). Other times, I'm pretty sure it would retrieve as default. We had gotten in the habit of checking that setting after every deploy, "just in case." – sfdcfox Jun 18 '15 at 21:09
  • @Neo, I believe, but can't verify, that it means it will continue to work even if it says the type is default rather than visualforce. The docs do state that this is specific to a managed package. I think that means the custom package setting will be used unless overridden specifically within the customers org. – Daniel Ballinger Jun 18 '15 at 21:29
  • It does seem to be using the override properly, but I perform a programmatic check so I can indicate to the user that the override is already in place. This check doesn't work if the metadata I get back doesn't let me know where the action will direct the user. – Neo Jun 18 '15 at 21:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.