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
AshanAshan 

Check Box Validation

Is there a way to validate my check box field , in order to keep only one of all objectes should have the field ticked?

iBr0theriBr0ther

Only trigger can do it.

goabhigogoabhigo

Can you explain a bit more? What are you trying to do?

goabhigogoabhigo

Hey, create a unique text field and using Workflow field update, put the value as "Checked" when criteria (Checkbox__c && ISCHANGED(Checkbox__c)) is passed. Since unique fields will not allow duplicate values, you cannot check the checkbox again in other records.

 

Let me know if it helps.

AshanAshan

Thanks for you reply.

@PoorMan

I did it using a trigger. but i was looking for a easier way

@abhi_the1

I have a checkbox (active) in a custom object. 

if there is at least 1 record in the database with active ticked, I want to stop saving records with active ticked

goabhigogoabhigo

After creating unique field, WFR rule just change that record's value to unchecked and save, then select it and save. Now on, you will not be allowed to create/update other records with checkbox selected. Yes, I agree you can do it with triggers. But you will have other issues like test classes,code coverage, moving to production etc. I am a big fan of trigger.

Richa KRicha K

Hi,

I am not sure... but if you can use jquery and retrive the checkbox value whether ticked or not.........and do ur actions.........