+ Start a Discussion
Ravi sastriRavi sastri 

Button should be changed when status is changed

Hello Developers,
Below is the requirement
I have a custom object with status and button where if the Status is "In Progress" then the button might say "Submit Order" which when pressed, changes the Order Status to "Order Submitted" and then removes that button and replaces it with one such as "Complete Order." Can anyone please mention the template or demo code so that I can proceed.
Heather ThompsonHeather Thompson
If you are using a Visualforce Page, you can do something like this:
 
<apex:commanButton value={!IF(Status__c = 'In Progress', 'Submit Order', 'Complete Order')} action="{!YourAction}" />

or if the action is different in the controller
 
<apex:commanButton  action="{!YourAction}" rendered="{!Status__C = 'In Progress'}" value ="Submit Order" />

<apex:commanButton  action="{!YourAction2}" rendered="{!Status__C != 'In Progress'}" value ="Complete Order" />