You need to sign in to do that
Don't have an account?
santhosh konathala 17
Hi community below is my code .No compilation error.But when I switched into my user I am not getting the functionality?please help me where I did wrong?
Trigger createNotification on Account(After insert, After update)
{
list<Notification__c> notifyList = new list<Notification__c>();
list<user> varUser=[select id,name from user ];
for(account acc:Trigger.new)
{
if(varUser[0].name=='Kanaka konathala')
{
Notification__C notify=new Notification__C();
acc.name=notify.name;
notify.Test__C='Outbound';
notifylist.add(notify);
}
}
if(notifylist.size()>0)
{
insert notifylist;
}
}
{
list<Notification__c> notifyList = new list<Notification__c>();
list<user> varUser=[select id,name from user ];
for(account acc:Trigger.new)
{
if(varUser[0].name=='Kanaka konathala')
{
Notification__C notify=new Notification__C();
acc.name=notify.name;
notify.Test__C='Outbound';
notifylist.add(notify);
}
}
if(notifylist.size()>0)
{
insert notifylist;
}
}
All Answers
your code is working fine for user1. but for user2 Test__c field will be displayed as Inbound.How to achieve this...in that piece of code