function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

I want to add change owner button on Opportunity list view page

I want to add change owner button on opportunity list view page by using lightning componet  . i am  using below code but  can not see change owner button on my oppoty list page 
 doInit : function(component, event, helper) {
        var opportunityId = component.get("v.recordId");
        var action = component.get("c.changeOwnerMethod");
           opportunityId : opportunityId
        action.setCallback(this, function(response) {
            if(response.getState() === "SUCCESS") {
                console.log("opportunity Owner Changed To Current login User");
             var rec = response.getReturnValue();

<aura:component implements="force:hasRecordId,flexipage:availableForRecordHome,force:lightningQuickAction">
  <aura:attribute name="complete" type="Boolean" default="false" />
    <aura:attribute name="opportunityRecord" type="Object"/>
    <force:recordData mode="EDIT" aura:id="recordLoader"
                      targetFields="{!v.opportunityRecord}" />
    <aura:if isTrue="{!v.opportunity.OwnerId != $SObjectType.CurrentUser.Id}">
    <aura:if isTrue="{!not(v.complete)}">
        <lightning:input type="toggle" messageToggleActive="" messageToggleInactive="" label="Are you sure to take the ownership on this Opportnity record?" name="input1" onchange="{!c.handleClick}"/>

    <aura:if isTrue="{!v.complete}">
        Opportunity is assigned to new Owner. 
    <aura:if isTrue="{!v.opportunityRecord.OwnerId == $SObjectType.CurrentUser.Id}">
        opportunity is already assigned to owner.
I can see the utton via VF page implmentation but  my requirment is to display this via Lightning componet
Please  find my VF page code
<apex:page standardController="Opportunity" recordSetVar="opportunities" extensions="Workaround" showHeader="false"
        function showToast() {
                "title": "Success!",
                "message": "{!mySelectedSize} record updated successfully.",
                "type": "success"
    <apex:form id="muform">
        <apex:pageMessage summary="Selected Collection Size: {!mySelectedSize}" 
                          id="mupms" />
  <apex:pageBlock >
      <apex:pageBlockSection >
      <apex:inputField value="{!Opportunity.OwnerId}" />
    <apex:pageBlockTable value="{!selected}" var="opp">
        <apex:column value="{!opp.Name}"/>    
      <apex:commandButton action="{!Save}" value="Save" onclick="showToast();" />
      <apex:commandButton value="Cancel" action="{!cancel}" />
public class Workaround {
 ApexPages.StandardSetController setCon;

    public selectedSizeWorkaround(ApexPages.StandardSetController controller) {
        setCon = controller;

    public integer getMySelectedSize() {
                return setCon.getSelected().size();
    public integer getMyRecordsSize() {
        return setCon.getRecords().size();


Dushyant SonwarDushyant Sonwar
Did you added it on Opportunity Search Layout?User-added image

User-added image

Yes i have added the button in search layout ., 

i tried to created quick action button in 3 ways.

1.creating simple list change owner button , but when i am editing a layout i am not getting opportunity onwer field.
User-added image
User-added image
2 created button using VF page , added this button in search layout it is working but view we dont want using VF page , i want to implment the view like we get for taks.

3 button by calling lighting componet but this button  iption is not coming in seach layout

can you please share the screenshot of you change owner action button please.All 3 buttons area added in search layout , only 2nd option is working for me 
Dushyant SonwarDushyant Sonwar
You need to create a custom quick action for this if you want to show in lightning.

User-added image
can you post the screenshot of button or quick action where u created...i dont see update owner opotion for opportunity