I have a trigger that hands off its trigger context to a queueable class, so that I can them make outbound REST calls to initiate campaigns.
Trigger > queueable > processorClass with
- @future addToContactList() makes a REST call to create the contact list
- @future startDialing initiates the campaign dialing via a second REST call
As you might expect, sometimes startDialing() is initiated first, finds an empty Contact list for the campaign, and quits w/o accomplishing its task.
There are (naturally) several instances of this process, based on geographic regions, and the lists vary in size, so having separate scheduled jobs to create the initial records and populate the lists, and then others to initiate dialing, is unwieldy (in addition to consuming add'l schedule resources).
If I added the call to the startDialing() method within addToContactList(), I think the issue could be resolved. Are there any issues that you see with this approach? ** NOT AN OPTION (@future method call from inside an @future method)