You need to sign in to do that
Don't have an account?
prasanth kumar
The below is the all code. error is going if i remove this code. please help me to solve this.
entity is not org accessible error in apex class
The below is the all code. error is going if i remove this code. please help me to solve this.
if(! allquoteowners.contains(Owner.Name)) { if(opp1.stagename == 'Won - Delivery' && daysbetween >= 2) { opp1.Quote_Created__c=true; toUpdateopplist.add(opp1); } }
global class EmailNotifcation implements Schedulable { global integer daysbetween; global static String scheduleIt() { //To start job nxt minuted itself dateTime dt=System.now().addMinutes(1); String Csec,Cmin,Chr,Cday,Cmonth,CYear; Csec=String.valueof(dt.second()); Cmin=String.valueof(dt.minute()); string SchTimer = Csec+' '+Cmin+' * * * ?' ; EmailNotifcation emNOt = new EmailNotifcation(); //String SchTimer = '0 1 12 * * ?'; //String SchTimer = '0 1 * * * ?'; //String SchTimer = '0 0 2/3 * * ?'; return System.schedule('Email Notification', SchTimer,emNOt ); } global void execute(SchedulableContext SC) { emailNotificationMethod(); System.debug('----------in execute methid'); } public void emailNotificationMethod() { list<opportunity> toUpdateopplist= new list<opportunity>(); // procedure for getting all user names in slesforce Map<string,string> allusernamesmap= new map<string,string>() ; for(user u1:[select id,name from user] ) { allusernamesmap.put(u1.id,u1.name); } // getting all quote owner names. set<string> allquoteowners = new set<String>(); for(quote q1:[SELECT CreatedById FROM Quote]) { // .add(q1.CreatedById); string name1=allusernamesmap.get(q1.CreatedById); allquoteowners.add(name1); } // Prodecure for getting all opportunites records who is not created the quote list<opportunity> updateopps =new list<opportunity>(); for(opportunity opp1:[Select id, Owner.Name, Quote_Created__c, ClosedOwn_Date__c, stagename,closedate from Opportunity]) { daysbetween=opp1.closedate.daysBetween(date.today()); if(! allquoteowners.contains(Owner.Name)) { if(opp1.stagename == 'Won - Delivery' && daysbetween >= 2) { opp1.Quote_Created__c=true; toUpdateopplist.add(opp1); } } } // update toUpdateopplist; } }
You are accessing opportunity owner by Owner.Name without object reference that is the reason you are facing this issue.