Search code examples
salesforceapex-codevisualforce

Only buttons may be used in the CustomButtons


Hi i have to Deploy an existing eclipse project to our Developer org when i deploy it it gave me an error

Deploy Results:

File Name: layouts/Account-Account Layout carousel.layout Full Name: Account-Account Layout carousel Action: NO ACTION Result: FAILED Problem: Only buttons may be used in the CustomButtons

here is the source code of Account-Account Layout carousel.layout

<?xml version="1.0" encoding="UTF-8"?>
<Layout xmlns="http://soap.sforce.com/2006/04/metadata">
    <customButtons>Edit_Carousel_Test</customButtons>
    <excludeButtons>DataDotComClean</excludeButtons>
    <excludeButtons>Submit</excludeButtons>
    <layoutSections>
        <customLabel>false</customLabel>
        <detailHeading>false</detailHeading>
        <editHeading>true</editHeading>
        <label>Account Information</label>
        <layoutColumns>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>OwnerId</field>
            </layoutItems>
            <layoutItems>
                <behavior>Required</behavior>
                <field>Name</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>ParentId</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>AccountNumber</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>Site</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>Type</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>Industry</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>AnnualRevenue</field>
            </layoutItems>
        </layoutColumns>
        <layoutColumns>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>Rating</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>Phone</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>Fax</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>Website</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>TickerSymbol</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>Ownership</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>NumberOfEmployees</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>Sic</field>
            </layoutItems>
        </layoutColumns>
        <style>TwoColumnsTopToBottom</style>
    </layoutSections>
    <layoutSections>
        <customLabel>false</customLabel>
        <detailHeading>false</detailHeading>
        <editHeading>true</editHeading>
        <label>Address Information</label>
        <layoutColumns>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>BillingAddress</field>
            </layoutItems>
        </layoutColumns>
        <layoutColumns>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>ShippingAddress</field>
            </layoutItems>
        </layoutColumns>
        <style>TwoColumnsTopToBottom</style>
    </layoutSections>
    <layoutSections>
        <customLabel>false</customLabel>
        <detailHeading>false</detailHeading>
        <editHeading>true</editHeading>
        <label>Additional Information</label>
        <layoutColumns>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>CustomerPriority__c</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>SLAExpirationDate__c</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>NumberofLocations__c</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>Active__c</field>
            </layoutItems>
        </layoutColumns>
        <layoutColumns>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>SLA__c</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>SLASerialNumber__c</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>UpsellOpportunity__c</field>
            </layoutItems>
        </layoutColumns>
        <style>TwoColumnsLeftToRight</style>
    </layoutSections>
    <layoutSections>
        <customLabel>false</customLabel>
        <detailHeading>false</detailHeading>
        <editHeading>true</editHeading>
        <label>System Information</label>
        <layoutColumns>
            <layoutItems>
                <behavior>Readonly</behavior>
                <field>CreatedById</field>
            </layoutItems>
        </layoutColumns>
        <layoutColumns>
            <layoutItems>
                <behavior>Readonly</behavior>
                <field>LastModifiedById</field>
            </layoutItems>
        </layoutColumns>
        <style>TwoColumnsTopToBottom</style>
    </layoutSections>
    <layoutSections>
        <customLabel>false</customLabel>
        <detailHeading>false</detailHeading>
        <editHeading>true</editHeading>
        <label>Description Information</label>
        <layoutColumns>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>Description</field>
            </layoutItems>
        </layoutColumns>
        <style>OneColumn</style>
    </layoutSections>
    <layoutSections>
        <customLabel>true</customLabel>
        <detailHeading>false</detailHeading>
        <editHeading>false</editHeading>
        <label>Custom Links</label>
        <layoutColumns/>
        <layoutColumns/>
        <layoutColumns/>
        <style>CustomLinks</style>
    </layoutSections>
    <relatedLists>
        <fields>FULL_NAME</fields>
        <fields>CONTACT.TITLE</fields>
        <fields>CONTACT.EMAIL</fields>
        <fields>CONTACT.PHONE1</fields>
        <relatedList>RelatedContactList</relatedList>
    </relatedLists>
    <relatedLists>
        <fields>OPPORTUNITY.NAME</fields>
        <fields>OPPORTUNITY.STAGE_NAME</fields>
        <fields>OPPORTUNITY.AMOUNT</fields>
        <fields>OPPORTUNITY.CLOSE_DATE</fields>
        <relatedList>RelatedOpportunityList</relatedList>
    </relatedLists>
    <relatedLists>
        <fields>CASES.CASE_NUMBER</fields>
        <fields>NAME</fields>
        <fields>CASES.SUBJECT</fields>
        <fields>CASES.PRIORITY</fields>
        <fields>CASES.CREATED_DATE_DATE_ONLY</fields>
        <fields>CASES.STATUS</fields>
        <fields>OWNER_NAME</fields>
        <relatedList>RelatedCaseList</relatedList>
    </relatedLists>
    <relatedLists>
        <fields>TASK.SUBJECT</fields>
        <fields>TASK.WHO_NAME</fields>
        <fields>TASK.WHAT_NAME</fields>
        <fields>ACTIVITY.TASK</fields>
        <fields>TASK.DUE_DATE</fields>
        <fields>TASK.STATUS</fields>
        <fields>TASK.PRIORITY</fields>
        <fields>CORE.USERS.FULL_NAME</fields>
        <relatedList>RelatedActivityList</relatedList>
    </relatedLists>
    <relatedLists>
        <fields>TASK.SUBJECT</fields>
        <fields>TASK.WHO_NAME</fields>
        <fields>TASK.WHAT_NAME</fields>
        <fields>ACTIVITY.TASK</fields>
        <fields>TASK.DUE_DATE</fields>
        <fields>CORE.USERS.FULL_NAME</fields>
        <fields>TASK.LAST_UPDATE</fields>
        <relatedList>RelatedHistoryList</relatedList>
    </relatedLists>
    <relatedLists>
        <relatedList>RelatedNoteList</relatedList>
    </relatedLists>
    <relatedLists>
        <fields>ASSET.NAME</fields>
        <fields>ASSET.SERIAL_NUMBER</fields>
        <fields>ASSET.INSTALL_DATE</fields>
        <fields>ASSET.QUANTITY</fields>
        <fields>CONTACT.NAME</fields>
        <fields>ASSET.STATUS</fields>
        <fields>ASSET.IS_COMPETITOR_PRODUCT</fields>
        <relatedList>RelatedAssetList</relatedList>
    </relatedLists>
    <relatedLists>
        <fields>ACCOUNT.NAME</fields>
        <fields>OPPORTUNITY.NAME</fields>
        <fields>PARTNER.ROLE</fields>
        <relatedList>RelatedPartnerList</relatedList>
    </relatedLists>
    <relatedObjects>ParentId</relatedObjects>
    <showEmailCheckbox>false</showEmailCheckbox>
    <showHighlightsPanel>true</showHighlightsPanel>
    <showInteractionLogPanel>true</showInteractionLogPanel>
    <showRunAssignmentRulesCheckbox>false</showRunAssignmentRulesCheckbox>
    <showSubmitAndAttachButton>false</showSubmitAndAttachButton>
    <summaryLayout>
        <masterLabel>00hE0000000JOz5</masterLabel>
        <sizeX>4</sizeX>
        <sizeY>0</sizeY>
        <summaryLayoutStyle>Default</summaryLayoutStyle>
    </summaryLayout>
</Layout>

I am new to Salesforce know basic of visual force and apex can any one please help how to remove this error/problem


Solution

  • I suspect somebody has created a CUSTOM LINK with same name (link is the option selected by default). Go to your target environment, look in Setup->Customize->Accounts->Buttons and Links and verify, change type to "detail page button" if necessary. If there's no such button / link at all, you'll have to deploy it together with your layout or create it manually.

    In Eclipse IDE go to [your project]/objects/Account.object. You might want to hit "refresh from server" if the button was recently added.

    (If you don't have Account.object or the refresh brings back empty file - you'll have to modify your package.xml. If you're new I don't recommend modifying it by hand, best would be to right click, "Add/Remove metadata components" and use the checkboxes to include standard objects.)

    Scroll to the bottom of the file, there will be a section with one or many <weblink>....</weblink> tags. Verify that there exists a tag with same name as the name of the button. Something similar to this:

    <webLinks>
        <fullName>Edit_Carousel_Test</fullName> <!-- name is important -->
        <availability>online</availability>
        <displayType>button</displayType>       <!-- of course so is this part -->
        <height>600</height>
        <linkType>url</linkType>
        <masterLabel>Edit Carousel Test</masterLabel>
        <openType>sidebar</openType>
        <protected>false</protected>
        <url>/apex/someVisualforcePage?id={!Account.Id}</url>
    </webLinks>
    

    Finally - while building the deployment package make sure the "Account.object" is deployed together with your "Account-Account Layout carousel.layout". Or (because adding buttons or links is possible without deploying) you could decide to fulfill this dependency by manually creating a button with same name & behavior in the target organization.