I have created a print button and passed following javascript method :- enter image description here

When I am clicking on the button Print I am getting below error:- enter image description here

Please help.

Thank you.

  • 1
    Hi @vidya you can't use apex code on Custom button. This code only use on Visualforce pages. – Prem Anandh Aug 6 '18 at 7:26

you did everything correct except the code you added in the text area.

Visualforce code can't be executed here. Only javascript code will be executed here

You just need window.print();

Just put this in text box and try


You can't use apex tags in custom java script buttons. Just use window.print(); in your custom button it will automatically redirect you to print page.

enter image description here

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.