You need to sign in to do that
Don't have an account?
sushant sus
after update trigger
in map ,map<id,list<attachment>> attach=new map<id,list<attachment>>(); i am having id as parent id of attachment as opportunity . opportunity has one field type number count default set as 0
for(id ids: attach.keyset()){
list<attachment> acc= attach.get(ids);
opportunity op= new opportunity(id=ids);
1.system.debug('bbttttttt'+(Integer)acc.size()+'jjjj'+op);
2.op.count__c=op.count__c+(integer)acc.size();
3.system.debug('bbttttttt'+(Integer)acc.size()+'jjjj'+opCount__c);
2 line i am getting null pointer exception
1 line returns me acc size and opportunity id
3 line written me acc.size and null
why this is happening
it use to work when you initalise object as opportunity op= new opportunity(id=ids);
it create instance of that
but now its not working
.................................................
for(id ids: attach.keyset()){
list<attachment> acc= attach.get(ids);
opportunity op= new opportunity(id=ids);
1.system.debug('bbttttttt'+(Integer)acc.size()+'jjjj'+op);
2.op.count__c=op.count__c+(integer)acc.size();
3.system.debug('bbttttttt'+(Integer)acc.size()+'jjjj'+opCount__c);
2 line i am getting null pointer exception
1 line returns me acc size and opportunity id
3 line written me acc.size and null
why this is happening
it use to work when you initalise object as opportunity op= new opportunity(id=ids);
it create instance of that
but now its not working
.................................................
map has data
i wnt to know the point i mention in bold 1,3 why