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
mikeafter6mikeafter6 

URLFOR failing - trying to create a link to list-view (for a custom object)

I'm trying to create a link to the list-view for a custom object using URLFOR. I keep getting an 'Invalid paramater for function' error. (I've successfully been able to get this to work for .view & .edit.)

What am I doing wrong? Thanks!


ERROR: Invalid parameter for function URLFOR

VF CODE: Here is the failing code: I ommitted the beginning '
_apexpage>
_apexoutputLink value="{!URLFOR($Action.PersonTaskMessage__c.List,null,null,true)}">
click here.
_/apexoutputLink>
_/apexpage>

NOTE: '_' takes place of '


VARIATIONS ATTEMPTED:
1. value="{!URLFOR($Action.PersonTaskMessage__c.List,null)}
2. value="{!URLFOR($Action.PersonTaskMessage__c.List)}
3. attempted an apex:commandlink tag within an apex:form block, too.

Message Edited by mikeafter6 on 12-23-2008 08:20 AM

Message Edited by mikeafter6 on 12-23-2008 08:22 AM
Best Answer chosen by Admin (Salesforce Developers) 
mikeafter6mikeafter6

Solution:  To use the 'List' action (via URLFOR), use 2 parameters:

 

First Param:  name of action   (e.g. $Action.Account.List)

Second Param:  provide object type using the global variable $ObjectType  (e.g. $ObjectType.Account)

 

 

<apex:outputLink value="{!URLFOR($Action.AnySObject__c.List,$ObjectType.AnySObject__c)}"> Click Here </apex:outputLink>

 


 

All Answers

Sam.arjSam.arj
Check the following post. It may give you the answer:


http://salesforcesource.blogspot.com/2008/12/urlfor-function-finally-explained.html

http://salesforcesource.blogspot.com/2008/12/urlfor-function-finally-explained.html
mikeafter6mikeafter6

Your post is helpful and addressesd many of my questions about URLFOR syntax.  (It even helped with some of my custom actions). 

 

Unless I'm missing something, the List action isn't described in your blog.  For some reason, the 'List' action isn't working for me.  I'm trying to create a command link to an objects list page.  Also, it would be nice to specify a list-view to display.

 

Is URLFOR supposed to support the List action?

 

Thanks.

 

mikeafter6mikeafter6

Solution:  To use the 'List' action (via URLFOR), use 2 parameters:

 

First Param:  name of action   (e.g. $Action.Account.List)

Second Param:  provide object type using the global variable $ObjectType  (e.g. $ObjectType.Account)

 

 

<apex:outputLink value="{!URLFOR($Action.AnySObject__c.List,$ObjectType.AnySObject__c)}"> Click Here </apex:outputLink>

 


 

This was selected as the best answer