You need to sign in to do that
Don't have an account?
ch ranjeeth
I want to insert records when the page is reloading...i have written some code but its working with when i saving the page.Need help to wtire this code
<apex:page controller="Recordinsertion" action="{!method}">
</apex:page>
Controller:
public with sharing class Recordinsertion {
public PageReference method()
{
list<account> acclist=new list<account>();
for(integer i=50;i<80;i++)
{
account a=new account();
a.name='acc'+i;
acclist.add(a);
}
insert acclist;
return null;
}
}
</apex:page>
Controller:
public with sharing class Recordinsertion {
public PageReference method()
{
list<account> acclist=new list<account>();
for(integer i=50;i<80;i++)
{
account a=new account();
a.name='acc'+i;
acclist.add(a);
}
insert acclist;
return null;
}
}
when i refreshing the page it should insert some records in account its my scenario......
Instead of 'retrun null;' you can use below code
PageReference pg = new PageReference('/a00/o'); //Here in parameters you have to give your object path or
//PageReference pg = new PageReference('/apex/PageName');
pg.setRedirect(true);
return pg;
Cheers
Mani