My Apex class is
Class1:
Public class myclass{
//some code
public void save(){
invoice_policy__c inp=[select net__c,Internal_alerts__c,Send_Email__c,Email_Alerts__c,Send_To__c from invoice_policy__c where id=:selectin]; //getting error here
if(inp.Internal_alerts__c == true){
//some code
}
}
string Selectin;
Public string getSelectin(){return Selectin;}
public void setSelectin(string selectin){this.selectin = Selectin;}
public list<selectoption> getselectname(){
list<selectoption> option = new list<selectoption>();
for(Invoice_Policy__c invoice : [select id,name,Policy_Status__c from Invoice_Policy__c where Policy_Status__c='Active'] ){
option.add(new selectoption(invoice.Id,invoice.name));
system.debug('invocenameee'+invoice.Id);
}
return option;
}
}
My test class is
invoice_policy__c ip = new invoice_policy__c(name='TestPolicy',net__c='3',Policy_Status__c='Active',send_to__c='[email protected]',Email_Alerts__c='Before',Internal_Alerts__c =true);
ip.send_email__c='2';
insert ip;
system.debug('testttt'+ip);
myclass ic = new myclass();
ic.getselectin();
ic.setselectin('a0Wi0000000NMqbEAG');
ic.save();
Getting error as System.QueryException List has no rows for assignment to SObject Help on this please.
myclass
those related fields are displayed inInvoice
seealldata=true
is a bad idea: salesforce.stackexchange.com/a/8562/142