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
MTBRiderMTBRider 

Using $Action.Case.ChangeOwner in a pageBlockTable

When I try to use !URLFOR() with $Action.Case.ChangeOwner in a pageBlockTable like so: 

 

<apex:column headerValue="Ownership">
    <apex:outputLink value="{!URLFOR($Action.Case.ChangeOwner,c.id)}">[Assign]</apex:outputLink>
</apex:column>

 and then click on the link, i get the following error:

 

Unable to Access Page
The value of the "ids" parameter contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information.

 

How does using the URLFOR() function differ when using in a row of  a table from when using it in a plain old Details page?

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
MTBRiderMTBRider

Hi Sandeep -  URLFOR is not just for getting static resources.  If you a VF page and you want it to have the same link on it for changing an owner to a Account, Opportunity, Case, etc.,  as that on an out-of-the-box Salesforce page, you can do the following:

 

<apex:outputLink value="{!URLFOR($Action.Account.ChangeOwner,Account.Id)}">[Change Owner]</apex:outputLink>

For anyone interested, I figured out what the issue I was have was.  What I am building is a Case queue monitor where each case in the queue being watched is shown as a row in a pageblockTable.  The last column of each row has a heading of "Ownership" with two links; [Take] and [Assign].  Clicking Take will assign the case to the current user.  Clicking Assign pulls up the standard change ownership page.  

 

The problem is that apparently when using a list control and implementing StandardSetController, Salesforce assumes you want to do a mass update of the records in your list.  So where calling $Action.Case.ChangeOwner from a detail page would give you the standard change owner page that allows you to change the owner of one record, making the same call from a list gives you a URL that has /CaseMassAction in it.  It is a bit annoying that the good folks at Salesforce make so many assumptions about doing mass updates when using StandardSetController, but it is what it is.

 

To get around this, instead of calling URLFOR($Action.Case.ChangeOwner), I just specified the URL for the standard (non-mass change) owner change screen which is simply '/'+c.id+'/a'

 

It seems to work.

 

 

 

All Answers

sandeep@Salesforcesandeep@Salesforce

URLFOR is basically being used getting static resource mateiral.

MTBRiderMTBRider

Hi Sandeep -  URLFOR is not just for getting static resources.  If you a VF page and you want it to have the same link on it for changing an owner to a Account, Opportunity, Case, etc.,  as that on an out-of-the-box Salesforce page, you can do the following:

 

<apex:outputLink value="{!URLFOR($Action.Account.ChangeOwner,Account.Id)}">[Change Owner]</apex:outputLink>

For anyone interested, I figured out what the issue I was have was.  What I am building is a Case queue monitor where each case in the queue being watched is shown as a row in a pageblockTable.  The last column of each row has a heading of "Ownership" with two links; [Take] and [Assign].  Clicking Take will assign the case to the current user.  Clicking Assign pulls up the standard change ownership page.  

 

The problem is that apparently when using a list control and implementing StandardSetController, Salesforce assumes you want to do a mass update of the records in your list.  So where calling $Action.Case.ChangeOwner from a detail page would give you the standard change owner page that allows you to change the owner of one record, making the same call from a list gives you a URL that has /CaseMassAction in it.  It is a bit annoying that the good folks at Salesforce make so many assumptions about doing mass updates when using StandardSetController, but it is what it is.

 

To get around this, instead of calling URLFOR($Action.Case.ChangeOwner), I just specified the URL for the standard (non-mass change) owner change screen which is simply '/'+c.id+'/a'

 

It seems to work.

 

 

 

This was selected as the best answer