Activity Forums Salesforce® Discussions How to display a message when the trigger finishes?

  • Abhinav

    Member
    April 30, 2016 at 10:25 am

    Hello Ravi,

    You can't display an alert from a trigger. Trigger doesn't have any direct access to the user interface.

  • Sudhir

    Member
    June 9, 2017 at 2:40 pm

    Firstly, please try to provide a use case of your scenario.

    Now coming to your question, if the motive is to display a message on record detail page or layout, there is a way.

    Create a Vf page with outputPanel having rendered attribute. ReRender this panel id when your controller gets the boolean flag passed from trigger or you can make a query if you are using a boolean field in trigger. Embed this VF age on the layout.

    Initialize a boolean variable(you can use boolean field also) as false in the trigger. When your trigger finishes, paas a boolean variable as true into the vf page controller. Refer that boolean variable into vf page rendered attribute.

    There could be other similar ways. You could give it a try.

  • Pooja

    Member
    February 14, 2020 at 2:35 pm

    No, it is not possible to display any message from a trigger directly.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos