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
mtbdaysmtbdays 

URL for Change Record Owner link

On the Visualforce page that I have created I want to add the [Change] link next to the Record Owner name so that the record owner can be re-assigned to another user.   I know that the correct URL to change the Opportunity Owner looks something like this:

https://c.cs2.visual.force.com/006R00000032yPy/a?retURL=%2F006R00000032yPy

I am trying to go there with this Output Link tag:

Code:
<apex:outputLink value="{!$CurrentPage.parameters.id}/a?retURL=%2F{!$CurrentPage.parameters.id}">
   [Change]
</apex:outputLink>

 But it adds the "apex" part of my visualforce page's URL like so:

https://c.cs2.visual.force.com/apex/006R00000032yPy/a?retURL=%2F006R00000032yPy

How do I get the correct URL?

Thanks

amar joshiamar joshi
please check out the bellow link

may be its solve your problem

http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=765
mtbdaysmtbdays
It does not solve the problem.  First, from that post, it sounds like you cannot navigate back to the custom VF page and second, that solution suggests hard-coding the instance of salesforce, which in the post is https://c.na3.visual.force.com, into the link, which means that it would not work once the code is migrated from a sandbox to production.

harlequinharlequin
Try putting a forward slash in front of your link, like
 
Code:
 <apex:outputLink value="/{!$CurrentPage.parameters.id}/a—retURL=%2F{!$CurrentPage.parameters.id}">
   [Change]
</apex:outputLink>
  This should force the page to look for the link from the directory root, and not the 'apex' directory.
mtbclimbermtbclimber
Try this:

Code:
<apex:page standardController="Account">
    <apex:outputLink value="{!URLFOR($Action.Account.ChangeOwner,account.id)}">Change Owner</apex:outputLink>
</apex:page>

 

MTBRiderMTBRider
Excellent!  This works:
Code:
<apex:outputLink value="{!URLFOR($Action.Account.ChangeOwner,account.id)}">Change Owner</apex:outputLink>
 
Thanks!
MG ConsultingMG Consulting
Hi Andrew,

I was wondering if you could point me to the documentation that explains the various actions available.  As of yet, I haven't be able to find it, and thus, I've had trouble getting my head around actions, as I've had to resort to trial and error when I needed them.

Thanks a lot,
Mike
mtbclimbermtbclimber
There is a picker in the edit page for a custom button/link.
MG ConsultingMG Consulting
I've been using them solely in Visualforce pages thus far, so I didn't ever notice that there... so helpful, thanks!