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
KevSnellKevSnell 

Lead Field - Lead in Active Campaign - True or False

Hey all,


Is it possible to create a field in the Lead fields that shows whether a lead is in any active campaigns or not?

 

For example: It doesn't matter if they are in one active campaign or three active campaigns it would shows as true and if no campaign it would be false.

 

Thanks

Kev 

AmitSahuAmitSahu

Yes you can.

 

You can create a field on Lead. Query based on the Lead record on the Campaign. If there is any related Campaign which is active and related to the lead you can assign the value as true.

 

For this you need a trigger on Lead.

KevSnellKevSnell

Sorry I'm a little confused on how the trigger would look as wouldn't it need the trigger to be on save and so it would only update when you saved a record?

AmitSahuAmitSahu

You can try on Campaign create/update.. so when you will link a Lead to the Campaign that would trigger the trigger and update the Lead record that we just attached to the Campaign.

KevSnellKevSnell

I have to say today my brian is not working, as I can't figure out the logic of this trigger.

 

ie.

 

  • Lead is assigned to Active Campaign so lead field is set to true unless already assigned to another Acitve Campaign
  • Lead is assigned to Inactive Campaign so lead field is set to false unless already assigned to another Active Campaign 
  • Inactive Campaign is set to Active so lead field is set to true unless already assigned to another Active Campaign
  • Active Campaign is set to Inactive so lead field is set to false unless already assigned to another Active Campaign
  • Lead is removed from Campaign so lead field is set to false unless already assigned to another Active Campaign

 

I think that's it!!!

AmitSahuAmitSahu

 Lead insert/update trigger

  • Lead is assigned to Active Campaign so lead field is set to true unless already assigned to another Acitve Campaign
  • Lead is assigned to Inactive Campaign so lead field is set to false unless already assigned to another Active Campaign 

Campaign insert/update trigger

  • Inactive Campaign is set to Active so lead field is set to true unless already assigned to another Active Campaign
  • Active Campaign is set to Inactive so lead field is set to false unless already assigned to another Active Campaign

 

No trigger is required...once you delete the Lead .. there is no way you can set that to false....

 

  • Lead is removed from Campaign so lead field is set to false unless already assigned to another Active Campaign