+ Start a Discussion
kittu9kittu9 

Passing record ID to vf page through custom button

I created one custom button on Opportunity. By clicking that button have to open VF page for that page want to pass the current record ID

 

window.showModalDialog("/apex/UpdateFields?id="&{!Opportunity.Id},"","width=400; height=200;");

 

i Kept like this for button. When i am click on that button in the detail page getting "Unexpected token ILLEGAL" in alert box

 

Here am missing in this syntax??

Best Answer chosen by Admin (Salesforce Developers) 
MJ Kahn / OpFocusMJ Kahn / OpFocus
Try this:

window.showModalDialog("/apex/UpdateFields?id={!Opportunity.Id}","width=400; height=200;");

Your width and height arguments may need some work - check the doc on showModalDialog for details.
.

All Answers

MJ Kahn / OpFocusMJ Kahn / OpFocus
Try this:

window.showModalDialog("/apex/UpdateFields?id={!Opportunity.Id}","width=400; height=200;");

Your width and height arguments may need some work - check the doc on showModalDialog for details.
.
This was selected as the best answer
souvik9086souvik9086

Hi 

 Yes he is right, You remove the & from the link and use single quote

window.showModalDialog('/apex/UpdateFields?id={!Opportunity.Id}','height=200,width=400');

 

Thanks,

Pramod MaliPramod Mali
window.open("/apex/UpdateFields?id="&{!Opportunity.Id},"","width=400; height=200;");