function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
justin brown 7justin brown 7 

Multi-Command Button

Hi All,

I am attemtping to create a controller extension class that allows me to give two buttons on my VF page added functionality. I have a submit botton which should update a status picklist field thats on the object but not on the VF page, trigger an email notification to the record owner, and lock the record. I also have a similar button that should chage the status picklist value again and save the record. Any ideas on how i can get all of this functionality in two buttons using controller extensions?

Thanks
Swaraj Behera 7Swaraj Behera 7
Hi Justin,
Are you working on approval pocess as i have implemented the same functionality in my project.I can help you on this if you can give more clear requirement.
Thanks.
justin brown 7justin brown 7
Hi Swaraj, 
Yes, I intially created an approval process, however I found it difficult to connect that approval process to my VF page. So as a work around I'm attempting to accomplish that functionality through command buttons. I have a VF page that mirrors my submissions custom object and I am able to complete and save the record, how ever I would like the VF page to also contain the approve  button that is found on the standard approve/reject page, so that the user can complete the approval process completely from the VF user interface and not have to go to the standard salesforce for any steps of the approval process. I attempted to accomplish this through standard controller extensions however could not accomplish it. 

Thanks,
Justin
Swaraj Behera 7Swaraj Behera 7
Hi Justin,
Are you using below code for the object on which you are implementing Approval process.
 
<apex:relatedList list="ProcessSteps"/>
For Sending mail you can write code in the controller.
I believe it is easier for you to start the approval process when a user start saving the record.
when user click the command button ,add a pop up and when user select yes i want to go ahead for this scenario then uodate some checkbox variable there in the controller  which will start the entry criteria for the approval process and when you save the record approval process will start and record will be locked automatically.

Please let me know if you want further clarification.
Thanks
 
justin brown 7justin brown 7
Yes, I would like further clarification, on how to start tthe approval process on save, and also how to reference the approve/rejcect button on a VF page.

Thanks
 
Swaraj Behera 7Swaraj Behera 7
Hi Justin,Please use standard Save action method and create a boolean field in the same object.Create one more boolean field in the related object.Create a workflow to update the related object field to make it true.
In the entry criteria use this field to start the approval process.

If you want more clarification i can share my screen.

My Skype ID:swaraj.behera

Send me a request and reply me time to set tha call.

Thanks,
Swaraj