+ Start a Discussion
Karthik B.ax1475Karthik B.ax1475 

Workflow on checkboxes

Hi Geeks,

        For adding multiple addresses to an Account we have created a custom object with all address field. By checking default we have a workflow which uupdates all the fields on Account Record.


Here our requirement is when there should be only one default checked.


Let say

1. Address 1 marked as default

2. Added new Address 2

So here when checked default on Address 2 1st we need to uncheck from Address1 and the workflow will be fired for field update on account record.








If I understand you correctly only one record should be mark as Default at one time.

Is it your question? Means are you looking for this?




You need to write Apex for this.

I can suggest you 2 approaches for this.


Approach 1

Create a new formula field with named as "Make Default" and by click this link that record will be made as default.

for this you need to create one Formula field and one page and class and need to write a method which will get all the records and make all make default check box as false for other and make true for this only for this record.


Approach 2


Write simple trigger on this object and by clicking on of the default link get all the records in that object and make those as false expect the one record which causes this trigger fire.

In this case you have taken care this trigger will not made default of one record for some other field changes in some other records.


 Please let me know if you need any help in this regard and let me know your comments.

Karthik B.ax1475Karthik B.ax1475

Hi Dinesh,

       You are absolutely true this is what i'm looking for. I have seen two approaches mentioned i think approach 2 will better fit my requirement can you please help me to create trigger for this.


Please let me know if any additional info.







This is normal trigger and normal Query.

You just need to verify the old and new value of check box of those records and if not equal then only go into that condition and then write code.


First try at your end to write trigger and let me know if you have any difficulty.