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

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

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 ?


Here is my code

trigger Action_on_Closed_Won on Opportunity (after update)
    Opportunity ops_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' );
        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. :)