You need to sign in to do that
Don't have an account?
Jyosi jyosi
Trying to write the Trigger using hanlder class "nitial term of field expression must be a concrete SObject: LIST<Account> at line 7 column 6"
Hello Everyone,
Trying to write the trigger using handler class.I am getting below error
nitial term of field expression must be a concrete SObject: LIST<Account> at line 7 column 6
Below is the intinal code
TRIGGER CLASS
trigger AccountTestTrigeer on Account (before insert, before update) {
AccountTestTrigeerhandler handler = new AccountTestTrigeerhandler();
if( Trigger.isInsert && Trigger.isbefore )
{
handler.OnAfterInsert( Trigger.New );
}
}
####################
CALLING TRIGGER FROM THE BELOW CLASS.
public without sharing class AccountTestTrigeerhandler
{
Account oAccount= new Account();
public void OnAfterInsert()
{
oAccount.Industry = 'Cloud Computing';
}
}
Thanks for the help
Trying to write the trigger using handler class.I am getting below error
nitial term of field expression must be a concrete SObject: LIST<Account> at line 7 column 6
Below is the intinal code
TRIGGER CLASS
trigger AccountTestTrigeer on Account (before insert, before update) {
AccountTestTrigeerhandler handler = new AccountTestTrigeerhandler();
if( Trigger.isInsert && Trigger.isbefore )
{
handler.OnAfterInsert( Trigger.New );
}
}
####################
CALLING TRIGGER FROM THE BELOW CLASS.
public without sharing class AccountTestTrigeerhandler
{
Account oAccount= new Account();
public void OnAfterInsert()
{
oAccount.Industry = 'Cloud Computing';
}
}
Thanks for the help
I'm not sure what are you trying to do. But, if you want to set the value of Industry field on account in Trigger.new list, this code should set Industry as "Cloud Computing" as we're iterating the incoming Trigger.new List in the helper class. In the above code, we're creating a new variable of type Account, which has no reference to incoming accounts in Trigger.new:
Let me know if it helps.