Skip to main content
Mohd Nabeel (Coforge Limited) a posé une question dans #Apex
HI, 

I am trying to call my method in the anonymous window but it is showing me (Line: 1, Column: 24 Unexpected token '('.) this error. The class is static so it is not necessary to make an object or instance of that class..

AccountContact.onBefore(Account Name='asdf');

This is my code i am inserting an account with the account name
6 réponses
  1. 5 nov. 2019, 06:39
    Hi Mohd Nabeel,

    You are calling the method with incorrect parameter.

    Use this code this will help you to call the method from anonymous window.

    List<Account> accList = new List<Account>();

    accList.add(new Account(Name = 'Mohd Nabeel'));

    insert accList;

    AccountContact.onBefore(accList);

    If you found it useful please appreciate my efforts and mark it as the best answer

    Regards,

    Soyab