function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
dmattivi1.3948969980392463E12dmattivi1.3948969980392463E12 

How to show an object page layour if a specific condition is met

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' );
    }
}
Eli Flores, SFDC DevEli Flores, SFDC Dev
Search for 'saveURL' here and you'll get heaps of information about how to do this. :)