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
ivanmdvivanmdv 

Checkbox with Dialog Box

Hi Everyone,
I have been using salesforce for almost 2 years now but there's this requirement that's challenging me now. if it weren't for the pop up dialog box, this will be easy.. 

There is a custom checkbox in the Contact object that I need to process.
Upon saving/updating, I need to run a set of business rules

1. if the checkbox is checked, i need to query other contact records with the same parent account whose checkboxes are set to true.
1.1. if i found at least 1 record, i should pop up a dialog box saying there are other contact records whose checkbox's are set to "true".. in the end asking wether to continue or not (yes/no).
1.1.1.  if user clicks on yes, the checkbox on the other contact records will be set to "false", and the newly updated/inserted record's checkbox will be set to true.
1.1.2 if user clicks on no, everything will be updated except for the checkbox.
1.2. if no records found, update the record.
2. if the checkbox is unchecked, update the record

crop1645crop1645

ivanmdv

 

Assuming you are doing this with Visualforce plus a controller/controller extension; then have you looked at: http://www.salesforcegeneral.com/salesforce-modal-dialog-box/ ?

 

An alternative to the dialog box is to simply render a new field on the VF page asking for confirmation on next step combined with apex:pageMessage