You need to sign in to do that
Don't have an account?
noedskov
Linking a lead to a campaign
Hi all,
We use the API for various tasks and one of them is to create leads within salesforce which are generated from our website.
Now, a sub-set of these leads we want to make part of specific campaign and below I have included some example code.
No doubt I get the correct campaign but when I create a new lead and set the campaign (see code below) I get the following error message: Invalid foreign key relationship name Campaign
Any suggestions?
Cheers.
/Søren Nødskov Hansen
We use the API for various tasks and one of them is to create leads within salesforce which are generated from our website.
Now, a sub-set of these leads we want to make part of specific campaign and below I have included some example code.
Code:
String[] campaignIds = {"70120000000AFKy"}; //Campaign Id for Free Website Trial SObject[] campaigns = stub.retrieve("Name", "Campaign ID", campaignIds); //Retrieve matching objects (should only be one) Campaign campaign = null; for(int x = 0; x < campaigns.length; x++) { //Loop through objects found campaign = (Campaign)campaigns[x]; System.out.println("Got campaign: " + campaign.getName() + " with id: " + campaign.getId()); //Print name and id of campaign }
No doubt I get the correct campaign but when I create a new lead and set the campaign (see code below) I get the following error message: Invalid foreign key relationship name Campaign
Code:
lead.setCampaign(campaign);
Any suggestions?
Cheers.
/Søren Nødskov Hansen
Thanks for your input - it helped me a lot!
Just in case others are wondering how I ended up doing it here is that part of my code:
It seemed that just setting the campaign id and the lead id on the campaign member was sufficient in order to map the two objects.
/Søren Nødskov Hansen
All Answers
Thanks for your input - it helped me a lot!
Just in case others are wondering how I ended up doing it here is that part of my code:
It seemed that just setting the campaign id and the lead id on the campaign member was sufficient in order to map the two objects.
/Søren Nødskov Hansen