2

i have a requirement wherein I have a button on my VF page XYZ_VF

1.The button needs to open a create record page of an custom object 2.Also when the standard create page is displayed,its lookup field should be prepopulated

How can i extend the below code to implement my functionality?

Note:I am using custom controller

below is my code:

<apex:commandButton 
    value="Add Killer Checks" 
    action="!URLFOR($Action.DisplayCheck__c.New,$CurrentPage.Name,[CF00N20000009H4jV=$CurrentPage.Parameters.vname,CF00N20000009H4jV_lkid=$CurrentPage.Parameters.id])}" 
    style="float:center"/>

I get the below error:

Invalid parameter for function URLFOR Error is in expression '{!URLFOR($Action.DisplayCheck__c.New,$CurrentPage.Name)}' in component in page visitaudit_vf

Please help THanks

1 Answer 1

2

I think you've minced the URLFOR parameters.

  • first param is $Page
  • second param is Id
  • third param is ['param'='eters']
  • fourth param is Boolean

try this:

<apex:commandButton
    value="Add Killer Checks"
    action="{!URLFOR($Action.DisplayCheck__c.New, null, ['CF00N20000009H4jV'=$CurrentPage.Parameters.vname,'CF00N20000009H4jV_lkid'=$CurrentPage.Parameters.id])}"
    style="float:center"
/>
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .