You need to sign in to do that
Don't have an account?
nagamalli tadikonda
Missing id at index: 0
This is my vf page:-
<apex:page standardController="Account" extensions="StandardController1">
<apex:form >
<apex:pageBlock title="Account">
<apex:pageBlockTable value="{!accs}" var="a">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.industry}"/>
</apex:pageBlockTable>
<apex:pageBlockButtons location="top">
<apex:commandButton value="submit" action="{!submit}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
This is my apex:-
public class StandardController1 {
public List<Account> accs {set;get;}
Account acc {set;get;}
public StandardController1(ApexPages.StandardController controller){
String[] fields = new String[]{'name','industry'};
accs = new List<Account>();
controller.addFields(fields);
acc = (Account)controller.getRecord();
accs.add(acc);
}
public PageReference submit(){
Database.delete(accs,false);
PageReference p = new PageReference('/001/o');
return p;
}
}
i am getting this error:--- Missing id at index: 0
Error is in expression '{!submit}' in component <apex:commandButton> in page standardcontroller1: Class.StandardController1.submit: line 12, column 1
An unexpected error has occurred. Your development organization has been notified.
<apex:page standardController="Account" extensions="StandardController1">
<apex:form >
<apex:pageBlock title="Account">
<apex:pageBlockTable value="{!accs}" var="a">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.industry}"/>
</apex:pageBlockTable>
<apex:pageBlockButtons location="top">
<apex:commandButton value="submit" action="{!submit}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
This is my apex:-
public class StandardController1 {
public List<Account> accs {set;get;}
Account acc {set;get;}
public StandardController1(ApexPages.StandardController controller){
String[] fields = new String[]{'name','industry'};
accs = new List<Account>();
controller.addFields(fields);
acc = (Account)controller.getRecord();
accs.add(acc);
}
public PageReference submit(){
Database.delete(accs,false);
PageReference p = new PageReference('/001/o');
return p;
}
}
i am getting this error:--- Missing id at index: 0
Error is in expression '{!submit}' in component <apex:commandButton> in page standardcontroller1: Class.StandardController1.submit: line 12, column 1
An unexpected error has occurred. Your development organization has been notified.
I hope you you are passing Account Record ID in URL
All Answers
Please add '/'
PageReference p = new PageReference('/001/o/');
Thanks
Aniket
I hope you you are passing Account Record ID in URL