Print Button function in Salesforce

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite
1












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.







share|improve this question















  • 1




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
















up vote
1
down vote

favorite
1












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.







share|improve this question















  • 1




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












up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





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.







share|improve this question











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.









share|improve this question










share|improve this question




share|improve this question









asked Aug 6 at 7:23









vidya

82




82







  • 1




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












  • 1




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







1




1




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




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










2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










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






share|improve this answer



















  • 1




    Thank you.It worked . :)
    – vidya
    Aug 6 at 8:10

















up vote
1
down vote













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






share|improve this answer





















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "459"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f227835%2fprint-button-function-in-salesforce%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote



    accepted










    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






    share|improve this answer



















    • 1




      Thank you.It worked . :)
      – vidya
      Aug 6 at 8:10














    up vote
    2
    down vote



    accepted










    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






    share|improve this answer



















    • 1




      Thank you.It worked . :)
      – vidya
      Aug 6 at 8:10












    up vote
    2
    down vote



    accepted







    up vote
    2
    down vote



    accepted






    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






    share|improve this answer















    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







    share|improve this answer















    share|improve this answer



    share|improve this answer








    edited Aug 7 at 6:09


























    answered Aug 6 at 7:29









    Ratan Paul

    18.8k82463




    18.8k82463







    • 1




      Thank you.It worked . :)
      – vidya
      Aug 6 at 8:10












    • 1




      Thank you.It worked . :)
      – vidya
      Aug 6 at 8:10







    1




    1




    Thank you.It worked . :)
    – vidya
    Aug 6 at 8:10




    Thank you.It worked . :)
    – vidya
    Aug 6 at 8:10












    up vote
    1
    down vote













    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






    share|improve this answer

























      up vote
      1
      down vote













      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






      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        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






        share|improve this answer













        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







        share|improve this answer













        share|improve this answer



        share|improve this answer











        answered Aug 6 at 7:31









        Prem Anandh

        1718




        1718






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f227835%2fprint-button-function-in-salesforce%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            What is the equation of a 3D cone with generalised tilt?

            Color the edges and diagonals of a regular polygon

            Relationship between determinant of matrix and determinant of adjoint?