[SalesForce] Can you query new opportunity contact roles

Is it possible to use SOQL to list new opportunity contact roles added after a certain date? Ideally I'd like to schedule some apex that runs nightly, queries all new OCRs since the last run, then applies a change to the contacts — but can this be done with just the new ones, or would it affect all OCRs each time it runs?

Best Answer

Hi Matt this is possible. SOQL on Opportunity Contact Role

You can query opportunity Contact Role and have a scheduled batch to perform intended operations on newly created opportunityContactRole. Make sure you apply proper filter like using CreatedDate > :LAST_RUN or CreatedDate = TODAY [Considering you are processing all records.]

Related Topic