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












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
    11 hours ago
















up vote
1
down vote

favorite












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
    11 hours ago












up vote
1
down vote

favorite









up vote
1
down vote

favorite











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 11 hours ago









vidya

82




82







  • 1




    Hi @vidya you can't use apex code on Custom button. This code only use on Visualforce pages.
    – Prem Anandh
    11 hours ago












  • 1




    Hi @vidya you can't use apex code on Custom button. This code only use on Visualforce pages.
    – Prem Anandh
    11 hours ago







1




1




Hi @vidya you can't use apex code on Custom button. This code only use on Visualforce pages.
– Prem Anandh
11 hours ago




Hi @vidya you can't use apex code on Custom button. This code only use on Visualforce pages.
– Prem Anandh
11 hours ago










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 have to just need window.print();



Just put this in text box and try






share|improve this answer





















  • Thank you.It worked . :)
    – vidya
    10 hours ago

















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 have to just need window.print();



    Just put this in text box and try






    share|improve this answer





















    • Thank you.It worked . :)
      – vidya
      10 hours ago














    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 have to just need window.print();



    Just put this in text box and try






    share|improve this answer





















    • Thank you.It worked . :)
      – vidya
      10 hours ago












    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 have to 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 have to just need window.print();



    Just put this in text box and try







    share|improve this answer













    share|improve this answer



    share|improve this answer











    answered 11 hours ago









    Ratan Paul

    18.6k82463




    18.6k82463











    • Thank you.It worked . :)
      – vidya
      10 hours ago
















    • Thank you.It worked . :)
      – vidya
      10 hours ago















    Thank you.It worked . :)
    – vidya
    10 hours ago




    Thank you.It worked . :)
    – vidya
    10 hours ago












    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 11 hours ago









        Prem Anandh

        1066




        1066






















             

            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













































































            Popular posts from this blog

            Python Lists

            Aion

            JavaScript Array Iteration Methods