I would like to solve for this use case leveraging declarative Salesforce tools (Flow or Process Builder).
[Background in this org, we've enabled the "Add Account as Campaign Member" functionality, which is now available with the Spring '21 Release].
We need to build automation in Salesforce to accomplish the following:
Anytime an Opportunity is created in Salesforce, if the Opportunity > Primary Campaign Source field is blank, we need to look at the Account > Campaign History.
If this Account was included as a Campaign Member in any Campaign within 60 days prior to the Opportunity creation date, then auto-populate the Opportunity > Primary Campaign Source with the ID for the most recent Campaign.