1

Solution Needed: Allow all users to "Change" ownership of their Account but circumvent moving open opps, contacts, and open activities to the new Account Owner (default salesforce functionality). We just want the Account Ownership changed.

Comments: Trying to identify the best development approach to reconcile the issue where 'Open Opportunities', all contacts within the account owned, and all notes and open activities for this account owned are automatically updated to the new Account Owner when utilizing the default "Change" on the Account Ownership field on the Account Page.

Image 1

Would I need to create custom visualforce section on the Account page that recreates the "look and feel" of the Account Owner {Change} field first which opens a new VF page that mirrors the standard functionality driven by custom apex? We could add the default options that would be removed as elective radio buttons at the bottom (transfer all "Open" opps, transfer all open activities, transfer all contacts related to the Account).

Image 2

Thanks in advance for any feedback!

  • 1
    One approach would be to create a custom VF page that is used to override the standard behavior of the View button. The custom VF page wouldn't be able to use apex:detail as that will give you standard SFDC Change Owner functionality. Thus, you would need to rebuild the Account page, field by field (apex:inputField) (or use fieldsets). Plus all the apex:relatedList components. Then you could create an apex:commandLink that would look like 'Change Owner' (positioned appropriately) that would go to a custom VF page to do the change owner functionality as you desire – cropredy Feb 11 '14 at 0:14
  • That is the issue. I am trying to avoid changing the Account page to a VF page just to alter the {Change} function of the Account Owner. Does SFDC allow us to remove the {Change} on the Account Owner which drives standard Salesforce functionality. I would hope to add a custom button that takes me to a VF page that gives me the features of the 'Ownership Edit' screen (Transfer open opportunities not owned by the existing account owner, Transfer closed opportunities, Transfer open cases owned by the existing account owner, etc). – Girod Feb 11 '14 at 16:42
1

Try this. It shuld help get started and uses all of the Standard SFDC functinaility without needing Triggers/APEX

Create Page > Create New Button (List Button: Source = VisualForce Page) > Edit Search Layouts for Accounts and Add this button to the List View

This screen allows you to transfer an account from one user to another. When you transfer ownership of an account, the new owner will also gain ownership of the following records related to the transferred account:

  • all notes and open activities for this account owned by the current account owner
  • all related notes and open activities owned by current account owner
  • all opportunities within the account owned by current account owner, including all related notes and open activities owned by current account owner

Note that completed activities will not be transferred.

The new owner might need to edit sharing.

| improve this answer | |
1
<apex:page standardController="Account"
    recordSetVar="accounts"
    showHeader="true"
    id="muopp"
>
<apex:form id="muform">
        <apex:pageBlock title="Account Mass-Transfer" mode="edit" id="mub1">
            <apex:pageMessages />
<apex:pageMessage summary=""
            severity="info"
            id="mupms"
>
This screen allows you to transfer an account from one user to another. When you transfer ownership of an account, the new owner will also gain ownership of the following records related to the transferred account:
<ul>
<li>all notes and open activities for this account owned by the current account owner</li>
<li>all related notes and open activities owned by current account owner</li>
<li>all opportunities within the account owned by current account owner, including all related notes and open activities owned by current account owner</li>
</ul>
<p><strong>Note that completed activities will not be transferred.</strong></p>
<p>The new owner might need to edit sharing.</p><p></p>
 </apex:pageMessage>
 <apex:actionSupport event="onload" rerender="muselectedlist"/>
            <apex:pageBlockSection id="mus1">
                <apex:inputField value="{!Account.OwnerId}" id="newOwner">
                    <apex:actionSupport event="onchange" rerender="muselectedlist"/>
                </apex:inputField>
            </apex:pageBlockSection>
            <apex:pageBlockButtons location="bottom" id="mubut">
                <apex:commandButton value="Save" action="{!save}" id="butsav"/>
                <apex:commandButton value="Cancel" action="{!cancel}" id="butcan"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
        <apex:pageBlock title="Selected Accounts" id="muselectedlist">
            <apex:pageBlockTable value="{!selected}" var="acc" id="mutab">
                <apex:column value="{!acc.name}" id="accname"/>
                <apex:column value="{!acc.OwnerId}" id="OwnerId"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
| improve this answer | |

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.