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
Sangeetha TSangeetha T 

Trigger or workflow

I have two checkbox fields in Lead and Contact objects  These fields would be tick marked if the customer has purchased the product in the past and the subscription period is active. . 

The requirement is 
- For every record in the Lead and Contact object, need to check if there is an opportunity and opportunity product associated with it
- If true then check if the associated Product name in the Opportunity product object contains the text "PubKLaw" or "PubKCyber" and the current date falls between start date and end date found in the Opportunity Product object
- If true then the above checkbox fields on the Lead and Contact objects for that particular customer needs to be checked
- This check needs to be dynamic that when the subscription ends the tick mark on those fields should be automatically removed 

Can i go for trigger or workflow would do a trick
Carlos Campillo GallegoCarlos Campillo Gallego
Hi Sageentha,

I think that rather than workflow you should go Process Builder, it gives you more flexibility than Workflows and I'm almost sure that you'll be able to build that logic in a formula.

Hi Sangeetha,

I would prefer triggers on Lead and contact objects because of the complexcity in requirement.  You can also do with process builder by calling apex classes.