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
debradebra 

Any tricks to change the label on a custom button based on data changes on the record?

Just starting out to develop a custom sync feature to replace the standard opportunity<->Quote sync.  For the UI changes we are thinking to implement a custom button on quote object but would want the label to change based on whether or not the quote is already sycning or not - very similar to how the standard sync button label changes.

Any suggestions on how we might implement this ?

I am farily new to Apex, Visualforce coding.

Sfdc CloudSfdc Cloud
You can't store changes of label in your salesforce database but you can display changes on custom vf pages based on passing javascript.

If an opportunity and a quote are synced, the opportunity identifies the synced quote in two places:
The Synced Quote field on the Opportunity detail page.
The Syncing checkbox in the Quotes related list.
If you stop the sync between a quote and an opportunity, the link is broken and the records are no longer automatically updated with each other's changes.

If this answer will help you out ,please mark it as best ans to help other :)

Thanks
debradebra
Thanks for the info.  I guess my question was too specific as it is not really related to the out-of-box quote sync feature.   I want to create a custom button on the Quote object and based on a field value on the Quote set the label of the button.  Ideally the field would be a checkbox (T/F) but if this is not easy to do could be changed to a text field with just two possible values.  The label should be set based on the field value  when the record is loaded or updated and should not require user to click the button.   The button will have custom code that will execute when it is clicked.
Sumit Kumar 8Sumit Kumar 8
Hi Zendebra,

Its a very easy to implement. with overriding the View with Page (having Detail Tag and some java script).

Thanks
Rajkumar VenkatRajkumar Venkat
Hi
You might have already found the answer to update it..

Assume the custom button name is issyncingcustom, include the below J$ into your Quote page. 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script>
$( document ).ready(function() {

var synButtonName='Start Sync';

 if('{!Quote.IsSyncing}'=='true')
{ synButtonName='Stop Sync';
}
$('[name="issyncingcustom"]').attr('value', synButtonName); });
}
</script>