• dmattivi1.3948969980392463E12
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi,
I'm pretty new in SF development and I would like to perform the following : when an opportunity is changing the status to closed won, I would like to show the page layout of a custom object.  I've written the following Apex code (for my test I imagine that my custom object is Account object), it seems that my condition is good but the account page doesn't display.  Could you please help me ?

Didier

Here is my code

trigger Action_on_Closed_Won on Opportunity (after update)
{
    Opportunity ops_new = Trigger.new[0];
    Opportunity ops_old = Trigger.old[0];
   
    if ( ops_new.IsWon && !ops_old.IsWon )
    {
        System.debug( 'Before Account' );
        Account a = new Account();
        System.debug( 'After Account' );
    }
    else
    {
        System.debug( 'Else' );
    }
}