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
RakeebRakeeb 

Scenario?

Hi All,here i have one scenario like ,

i have one custom button like "Approved" and Is enabled (checkbox) in custom object.When the user click the approve buttom then only Is enabled (checkbox) will be checked otherwise it should be in unchecked. so how can i do validation kindly let me know ASAP.

 

Thanks

skodisanaskodisana

Hi,

 

Set the field level security of Is enabled check box as read only for all the Profles.

Write a Visualforce page which calls an Apex code with sharing and update the checkbox.

Let me know if you have any questions.

 

Thanks,

Kodisana 

Ankit AroraAnkit Arora

Make sure the checkbox (Is Enabled) have default value to false while creating the field, that means all record will have that checkbox unchecked.

 

Now I let me know where do you have this "Approved" button. Is it on any visualforce page or a custom button which appear on native record layout?

 

If it is on visualforce page then you can use controller to update the record with your checkbox checked. If it is on native screen (Native custom button) then you can use javascript to do this.

 

{!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")}

var result = sforce.connection.query("Select Id From Account where IsEnabled = false and Id = '{!AccountId}' ");

var records = result.getArray("records"); 

 Please note I have not tried the above script, this is just to give you an idea. Using above script you can fetch the record values and similarly you can update the record.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

Ankit AroraAnkit Arora

To get more idea how you can write javascript you can visit :

 

http://www.interactiveties.com/b_execute_javascript_button.php

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

RakeebRakeeb

HI ankit,when we saved the record and we have standard button 'submit for approval' once we clicked the button it will active checkbox otherwise it should be in unchecked for that how can i do that kindly let me know the solution asap.