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
t.deepthi05t.deepthi05 

Standard action button

Hi,

 

Can we invoke standard action buttons dynamically in a test class.

Best Answer chosen by Admin (Salesforce Developers) 
samreet_matharu@psl.co.insamreet_matharu@psl.co.in

You can try the following:

Example :If you want to test the standard Account view:

 

Account account = [select id from Account limit 1];
ApexPages.StandardController sc= new ApexPages.StandardController(account);
sc.view();

All Answers

Praful GadgePraful Gadge

You can simply call the method you are invoking on an action button.

t.deepthi05t.deepthi05
calling the method does makes the onclick event true, My requirement is to invoke a button click event dynamically in test class
samreet_matharu@psl.co.insamreet_matharu@psl.co.in

You can try the following:

Example :If you want to test the standard Account view:

 

Account account = [select id from Account limit 1];
ApexPages.StandardController sc= new ApexPages.StandardController(account);
sc.view();

This was selected as the best answer
t.deepthi05t.deepthi05
That is not solution i want to invoke dynamically the standard lead Accept Button