0

We have enabled Customizable Campaign Influence in one of our orgs. There we are using Primary Campaign Source Model as the default model since we wanted to migrate from the old Campaign Influence version to the new one (basically to operate on Campaign Influence records programmatically).

We have written automation that will collect and delete the Campaign Influence records that are unnecessary considering our business logic. Also, we have enabled Campaign Influence - Auto. Association Settings with the condition -> Responded = TRUE.

Now we want to cover and unit test our above automation using test classes. In the test class we want to create those unnecessary Campaign Influence records and then manually run the above automation code to delete those records. However, since the Campaign Influence records are created by some automated process (due to the Campaign Influence Auto Association Settings), we are not able to query those records in the test methods. Note that we have tried writing the logic that triggers Campaign Influence record creation inside Test.startTest() and Test.stopTest() block and then querying CampaignInfluence records outside of the block. However, the records are not getting created.

Any ideas on how to make this work?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.