How to pass Trigger.New to Apex class in Salesforce?

Sample Code:


trigger Sample on Opportunity (before update, before insert) {
    if (Trigger.isInsert) {
    } else if (Trigger.isUpdate) {
        SampleApexClass.SampleMethod1(, Trigger.old);

Apex Class:

global class SampleApexClass () {
    global static void SampleMethod(List<Opportunity> NewOpps
) {
        /* trigger code*/

    global static void SampleMethod1(List<Opportunity> NewOpps, List<Opportunity> OldOpps) {
        /* trigger code*/



No comments:

Post a Comment

Sharing is Caring!!! Share this with your friends!!!

submit to reddit