You need to sign in to do that
Don't have an account?
santhosh konathala 17
can anybody resolve this getting problem' no viable alternative at character'.
public class NotificationServiceClass {
public void onAfterInsert (Account[] newAccounts){
List<Notification__c> notifyInsertList = new list<Notification__c>();
for(Account accname:newAccounts){
Notification__c notify=new Notification__c();
notify.name=accname.name;
notify.Action__c='Add';
If(userinfo.getusername() == 'Kanaka konathala')
notify.Test__c='Outbound';
If(userinfo.getusername() == 'reddy kon')
notify.Test__c='Inbound';
notifyInsertList.add(notify);
}
insert notifyInsertList;
}
public void onAfterUpdate(Account[] newAccounts, map<id, Account> oldMap ){
List<Notification__c> notifyUpdateList = new list<Notification__c>();
for(Account Acc:newAccounts){
Account oldAcc = oldMap.get(Acc.Id);
if(Acc.name!=oldAcc.name){
Notification__c notifyUpdate = new Notification__c();
notifyUpdate.name=Acc.name;
notifyUpdate.Action__c= 'Modify';
If(userinfo.getusername() == 'Kanaka konathala')
notifyUpdate.Test__c='Outbound';
If(userinfo.getusername() == 'reddy kon')
notifyUpdate.Test__c='Inbound';
notifyUpdateList.add(notifyUpdate);
}
}
if(notifyUpdateList.size()>0 && notifyUpdateList.size()!=null){
insert notifyUpdateList;
}
}
}
public void onAfterInsert (Account[] newAccounts){
List<Notification__c> notifyInsertList = new list<Notification__c>();
for(Account accname:newAccounts){
Notification__c notify=new Notification__c();
notify.name=accname.name;
notify.Action__c='Add';
If(userinfo.getusername() == 'Kanaka konathala')
notify.Test__c='Outbound';
If(userinfo.getusername() == 'reddy kon')
notify.Test__c='Inbound';
notifyInsertList.add(notify);
}
insert notifyInsertList;
}
public void onAfterUpdate(Account[] newAccounts, map<id, Account> oldMap ){
List<Notification__c> notifyUpdateList = new list<Notification__c>();
for(Account Acc:newAccounts){
Account oldAcc = oldMap.get(Acc.Id);
if(Acc.name!=oldAcc.name){
Notification__c notifyUpdate = new Notification__c();
notifyUpdate.name=Acc.name;
notifyUpdate.Action__c= 'Modify';
If(userinfo.getusername() == 'Kanaka konathala')
notifyUpdate.Test__c='Outbound';
If(userinfo.getusername() == 'reddy kon')
notifyUpdate.Test__c='Inbound';
notifyUpdateList.add(notifyUpdate);
}
}
if(notifyUpdateList.size()>0 && notifyUpdateList.size()!=null){
insert notifyUpdateList;
}
}
}
Try this once and let me know.If it didn't work please post the line number and screen shot of your code. If it works mark it as best answer.
Thanks.
All Answers
Please share line number.
Thanks
Thanks for your help..
In above code I am getting problem in onAfterinsert method
Try this once and let me know.If it didn't work please post the line number and screen shot of your code. If it works mark it as best answer.
Thanks.
Hi Thermo,
Thank you soo much.Now it compiled.May I know where you kept modified to resolve this issue..
Thats it.