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
giri rocksgiri rocks 

In datatable select campaign name field using checkbox

In datatable select  campaign name  field using checkbox and and insert that particular contact name in select campaign name as a campaign member



please help....urgent


Can you elaborate the issue that you are facing. I am not able to understand what is exactly that you are looking for? 

giri rocksgiri rocks

Campaign Member from Checkbox Trigger

Use case:

We have situations where we manage what communications someone gets based on a checkbox on their record in salesforce. Each checkbox will correspond to a campaign in Salesforce. When the value of that checkbox on the record is edited, we would like the status of that checkbox to create/delete a corresponding Campaign Member. As this is something we have multiple uses for, we would like it to be done in a way that we can tweak to re-purpose as needed.

Desired design:

- The trigger should be set up to allow us to specify one or more custom checkbox fields that trigger campaign member creation. For each checkbox we will be able to specify the corresponding campaign.
- The campaign that the campaign member will be created on should be easily specifiable in the trigger code (for example, by UID).
- The campaign member should be created with the default status
- The code delivered should include (a) a version for contacts and (b) a version that will work for leads.

Acceptance criteria:

- The trigger will add one (and only one) campaign member per contact record that is edited to check a checkbox field
- The trigger will remove only the corresponding campaign member for a contact record where the checkbox is unchecked and saved
- Needs to have test coverage required by salesforce for deploying to production
- The code should have comments where reasonable to help in understanding and reusing
- The trigger needs to be able to be extended to manage multiple checkbox-to-campaign pairings in one trigger (ie 3 checkboxes that correspond to 3 different campaigns)




It took me a while to respond. I was off for a week and I just catching up on what I had missed over the week. I see what you are interested in doing. I have a good idea of what needs to be done. Let me think through the process and get back to you. I will reply by Monday.