• BDSjim
  • NEWBIE
  • 0 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I wrote a script that creates a CampaignMember for a Lead for when people respond to our web campaigns.  Since we already know who they are, they don't need to fill in the full lead form again.

I am using this code to create the CampaignMember for the Lead:

PHP Code:
  $sObject = new SObject();
$sObject->type = 'CampaignMember';
$fieldsToUpdate=array(
'CampaignId'=>$selected['campaignid'],
'LeadId'=>$found_id,
'Status'=>'Responded',
);
$sObject->fields = $fieldsToUpdate;
$newrec = $GLOBALS['sfconnection']->create(array($sObject));

 
The code creates the CampaignMember perfectly, but I was testing and found that if I "responded" to the same campaign a second time it would clear out the CampaignMember.FirstRespondedDate ... but then if I responded yet again, the FirstRespondedDate would appear again.  So, when "responding" to the campaign multiple times it looks like this:
1.  CampaignMember created, FirstRespondedDate is populated
2.  CampaignMember updated, FirstRespondedDate is erased
3.  CampaignMember updated, FirstRespondedDate is populated
4.  CampaignMember updated, FirstRespondedDate is erased
... and so on...

I could do a search and determine if i just need to update a field, but it seems like a lot of extra SOAP calls to execute when there is obviously already some trigger on the CampaignMember table checking for duplicates - maybe it could not erase the FirstRespondedDate. 

Am I making a mistake with something here?
  • April 13, 2007
  • Like
  • 0
Hello everyone....

I'm trying to query the salesforce database... I can successfuly login into the salesforce, but there seems to be something wrong with the query... can anybody help me here?

I'm ussing a login code, and then this...

try
{
    $result = $sforce->query(array("queryString" => "select Id from Lead where Lead.FirstName='Miguel'"));
    print_r($result);
    print "I'm not reaching this print";
} catch (Exception $e)
{
    print_r($e);
}


what happens is that it doesn't print the "I'm not reaching this print"... can anyone help me with this?
thank you

M.
  • June 12, 2007
  • Like
  • 0
Hi,
              I have been trying to create a Lead which includes the Campaign Name.But getting the error
INVALID_FIELD: No such column 'Campaign' on entity 'lead'.
How can i take the campaign name to get it inserted into the Lead Table using the API
Any sample code is appreciated
  • April 20, 2007
  • Like
  • 0