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
gotherthanthougotherthanthou 

Change Owner Question

I'm trying to get the owner field and ChangeOwner link onto a VF page for a custom object.  Owner field is just fine.  But I can't get ChangeOwner to work.

 

I'm trying this code:

<apex:outputLink value="{!URLFOR($Action.CustomObject__c.ChangeOwner,CustomObject__c.id)}" rendered="true" >[Change]</apex:outputLink>

 

When the page renders, the link shows up fine.  But when I try clicking on the link it sends me to the login page saying in red that I have to be logged in to perform that function.  I am, obviously, already logged in when I click the link.

 

Ideas?

Best Answer chosen by Admin (Salesforce Developers) 
gotherthanthougotherthanthou

An FYI post...

 

I got an answer from support on this.  Apparently !URLFOR($Action is not working for custom objects.  

 

Workaround is:

 

<apex:outputLink value="/{!CustomObject__c.id}/a?retURL=/apex/NameOfCustomVFPage?id={!CustomObject__c.id}">[Change]</apex:outputLink>