You need to sign in to do that
Don't have an account?
venkyyy
Want to be stay on detail page itself, after click on save button.
Hi all,
Please clarify my doubt,
My Question is: through controller i want to save account record, after saving perticular record i want to be stay on corresponding detail page itself. Please see the bellow vf page and apex class and suggest me what i need to add to get detail page.
Thanks in advance,
venkat.
The Page is:
------------------
<apex:page controller="SaveAccount">
<apex:form >
<apex:pageblock title="Enter Account Details">
<apex:pageblockSection >
<apex:inputtext value="{!AcName}" label="Acc_Name"/>
<apex:inputtext value="{!AcPhone}" label="Acc_Phone"/>
</apex:pageblockSection>
<apex:pageblockButtons location="Bottom" >
<apex:commandButton action="{!Save}" value="Save"/>
</apex:pageblockButtons>
</apex:pageblock>
</apex:form>
</apex:page>
----------------------------------
class is:
----------------------------------
public with sharing class SaveAccount {
public PageReference Save() {
account ac = new account();
ac.name = AcName;
ac.phone = AcPhone;
insert ac;
return null;
}
public String AcPhone { get; set; }
public String AcName { get; set; }
}
Please clarify my doubt,
My Question is: through controller i want to save account record, after saving perticular record i want to be stay on corresponding detail page itself. Please see the bellow vf page and apex class and suggest me what i need to add to get detail page.
Thanks in advance,
venkat.
The Page is:
------------------
<apex:page controller="SaveAccount">
<apex:form >
<apex:pageblock title="Enter Account Details">
<apex:pageblockSection >
<apex:inputtext value="{!AcName}" label="Acc_Name"/>
<apex:inputtext value="{!AcPhone}" label="Acc_Phone"/>
</apex:pageblockSection>
<apex:pageblockButtons location="Bottom" >
<apex:commandButton action="{!Save}" value="Save"/>
</apex:pageblockButtons>
</apex:pageblock>
</apex:form>
</apex:page>
----------------------------------
class is:
----------------------------------
public with sharing class SaveAccount {
public PageReference Save() {
account ac = new account();
ac.name = AcName;
ac.phone = AcPhone;
insert ac;
return null;
}
public String AcPhone { get; set; }
public String AcName { get; set; }
}
Try to change the class code like below and let me know if it helps .
Thanks
Manoj
and can we have a clone buttone on detail page(i mean after saving a record we get detail page, on that detail page if i want to clone that record,)
Then you can make use of Clone() and View() methods from standard controller for cloning and redirecting to detail page respectively.
There is no need to write code for cloning the record. You could simply enable the clone button on the page layout.