enter image description here

When I click on the PB-005438 ({!p.Id}), wants to redirect to a new VF page layout (gibco2) with all vlues. But when I click on it, gives me a error. Any idead Why is that? Thanks.

<apex:page standardController="Product_Brief__c" extensions="DispatcherContactNewController">
            <apex:pageBlock title="Recent Product Briefs">
                <apex:pageBlockTable value="{!pbs}" var="p" >
                    <apex:column >
                        <apex:commandLink action="{! assetClicked}" value="{!P.Name}" id="theCommandLink"> 
                        <apex:param value="{!P.Name}" name="id" assignTo="{!selectedAsset}" ></apex:param>
                     <apex:column value="{!p.RecordTypeId}"/>


public class DispatcherContactNewController {

    public DispatcherContactNewController(ApexPages.StandardController controller) {
                this.controller = controller;

    public ApexPages.StandardSetController setpb{
                if(setpb == null){
                    setpb = new ApexPages.StandardSetController(Database.getQueryLocator(
                        [SELECT Id, Name, RecordTypeId, Createddate FROM Product_Brief__c ORDER BY Createddate DESC ]));
                             return setpb;

        public List<Product_Brief__c>getpbs(){
            return (List<Product_Brief__c>)setpb.getrecords();
/* ---------- For Redirect to New Page ------ */
 public string selectedAsset {get;set;}
    public PageReference assetClicked() 

    PageReference redirect = new PageReference('/apex/gibcopb2'); 

    // pass the selected asset ID to the new page

    return redirect;
  • 1
    Unless you have some processing you need to do in your controller, using an apex:outputLink will make your links more responsive as they will take the user in a single GET to the new object. The apex:commandLink (when you get it working) will first POST all the view state back to the server (2 seconds?) and then return a page which will tell the browser to GET the new object. – Keith C Jul 8 '15 at 16:56
  • 1
    @KeithC Will apex:commandLink post the apex:param to server if its not having a rerender attribute? – Vigneshwaran G Jul 8 '15 at 17:07
  • @VigneshwaranG I believe so but I may be wrong. – Keith C Jul 8 '15 at 17:12

Problem 1:

apex:commandLink is not having rerender attribute thus not posting the value in apex:param to controller.

Problem 2:

If the value attribute is a bind variable in apex:param and the name attribute is a literal value, the value is not getting passed to controller.

Change the name="id" in the apex:param to name="{!P.Name}"

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.