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
treemarktreemark 

CampaignMembers and WSAPI joins

I have a question relating to CampaignMembers and the lack of joining behavior in the WSAPI.

Specifically, I'm writing a one click export feature for campaign members. I intend to use a sControl in the weblinks layout on a campaign detail page to launch a URL on an external server. That server will then use the Partner WSAPI to obtain a list of all leads and contacts associated with the campaign, populating a custom 'friendly' user ID field on leads and contacts as it goes.

The problem is performance. Because I have no join functionality, I have to first select all the CampaignMember records, then iterate over that record set and select the corresponding lead or contact records one at a time. Sinse this needs to scale up to tens of thousands or records the performance is to poor to move forward.

I've seen a similar feature in use at Vertical Response, and it runs many times faster than my prototype. What can I do differently to work around this issue?

Mark Orr
Chief Architect
enContext Solutions

adamgadamg
Your best bet is probably to use SQOL / query get the array of IDs for each object and then do a retrieve, which will reduce the number of API calls from n to 3. (One for campaignmember, contact and lead.)
treemarktreemark

That worked very well, thanks for the help.

Mark