+ Start a Discussion
Rahul22Rahul22 

Update Custom setting field using a checkbox


Hi Experts,

My requirement is to update custom settings field (checkbox) upon updating a checkbox on user layout. In short I want to control custom setting checkboxes from user layout directly.

I have a custom settings object A  [two fields A1(User lookup) and A2(Checkbox)] 
and
Object B [two fields B1 and B2 (checkbox)]

I want to update checkbox fields (A2 and B2) to true whenever I turn on the checkbox on user layout. 

Is this possible?? 

Thanks in advance! Prefferd if it can be done using Out of Box functionality.

Best Regards,
Rahul
 
Naresh YadavNaresh Yadav
Hi Rahul,

Here you can use a trigger. So whenever you update the field on the user just fetch the custom setting you want to update and make checkboxes to true and then update.

One use case is that custom setting type. 
  1. If it is list custom setting just get the values using gtAll() OR getValues() methods and just update them.
  2. If it is Hierarchy Custom Setting get the values using getInstance(userId). This method returns the user-specific values so you can update only your values.

Let me know if it is helpful. And mark it as best.

Thanks
Naresh Y.