You need to sign in to do that
Don't have an account?
Help with Detail Page Button.
Hi ,
I have a requirement where in I need to have a Detail Page Button called Confirm Opportunity . When the users Click this button the Opportunity Approval Status must change to " Approved" from "To Be Confirmed " and the record type and page layout must change back to the original one before the Opportunity Approval Status was set to "To Be Confirmed".I used the On Click Java Script type and I wrote the below code for the first part but I am not sure if it is Java Script and why it is not working, it gives the below error .Also can someone please help me writing the second part that is changing the record type and page layout back to the original one since I have not had much experience with this.
Error - Missing ; before Statement .
if( '{!Opportunity.Approval_Status__c}'=='To Be Confirmed' && '{!Opportunity.RecordType}' == "To Be Confirmed")
{
{!Opportunity.Approval_Status__c} = "Approved";
}
Hi ,
The above required detail page button is part of a process which changes the Approval Status to "To Be Confirmed" once it has been approved by the directors . Once this is done a trigger fires changing the Record type to "To Be Confirmed".
I have managed to work out the detail page button using a Visual Force page . there was a Controller Class which I created and when the button"Confirm Opportunity " is pressed it changes the Approval Status to "Approved" from "To Be Confirmed" . Also Now I need to include in the Controller class a line of code which will change the Record Type back to the Original one , that is the one it was before the trigger fired and changed it to "To Be Confirmed ". Can someone please help me with this . Here is my Controller Class
public class COController {
private final Opportunity o;
public COController(ApexPages.StandardController controller)
{
this.o = (Opportunity)Controller.getRecord();
}
public PageReference autoRun(){
{
o.Approval_Status__c='Approved';
database.update(o);
}
String theId = ApexPages.currentPage().getParameters().get('id');
if (theId == null) {
return null;
}
PageReference pageRef = new PageReference('/' + theId);
pageRef.setRedirect(true);
return pageRef;
}
}
Thanks