Re: syncLead creates duplicate

Anonymous
Not applicable

syncLead creates duplicate

Hello -

My developer is using the syncLead for the web service API to push info from a custom form to Marketo, and when someone submits the form, it is creating two records simultaneously in Marketo - below is what he is sending to Marketo - any help would be greatly appreciated:

$arguments=array(

'leadRecord'=>array(

'Email'=>$email,

'leadAttributeList'=>array(

$this->getAttribute('FirstName',$firstname),

$this->getAttribute('LastName',$lastname),

$this->getAttribute('Email',$email),

$this->getAttribute('Phone',$phone),

$this->getAttribute('Country',$country),

$this->getAttribute('PostalCode',$postalcode),

$this->getAttribute('new_usertype_lead',$usertype),

$this->getAttribute('new_formname',"SPX Trial"),

$this->getAttribute('LeadSource',"SPX Trial"),

),

),

'returnLead'=>false,

);

$arguments=array('paramsSyncLead'=>$arguments);

return $this->client->__soapcall('syncLead',$arguments,null,$this->getAuthenticationHeader());

Thanks,

Mike

7 REPLIES 7
Josh_Hill13
Level 10 - Champion Alumni

Re: syncLead creates duplicate

This is really a question for Sanford Whiteman​. How else did you construct the form? I wonder if you are posting twice by accident or have some other call at the same time.

SanfordWhiteman
Level 10 - Community Moderator

Re: syncLead creates duplicate

Agree with Josh.  It sounds like you're running this function twice, so we'd need to see the entire code from top to bottom.  Either that or you're also submitting the form from the client at the same time.  Note you don't need the SOAP API at all to perform this task, and I don't recommend it.   If you're just gathering form data and proxying (relaying) it to Marketo, then use the Forms 2.0 API to send it from client --> Marketo. Cut out the middle man and save yourself a DoS, too.

Anonymous
Not applicable

Re: syncLead creates duplicate

Thanks guys, however, the form is a custom form inside one of our software programs that also triggers other services for product licensing etc., so I have no control over the form.  I also cannot share anything additional due to company legality.

SanfordWhiteman
Level 10 - Community Moderator

Re: syncLead creates duplicate

OK. Without inspecting the code that calls this function, there would be no way to tell you why it's being called twice.  Probably there's some broken flow control in the surrounding code. I'll repeat my caution about using the SOAP API even more strongly if this is being used in a LOB app... if you can't issue licenses after 10,000 posts, that's not good.  At least call your Mkto rep and up your daily limit.

Anonymous
Not applicable

Re: syncLead creates duplicate

Thanks Sanford.  I was able to get the module code...

http://pages.storagecraft.com/Sandbox-items_spx-form-info.html

Any help would be greatly appreciated.

SanfordWhiteman
Level 10 - Community Moderator

Re: syncLead creates duplicate

Mike, I scanned the code a few times (though that is no substitute for running it in context) and don't see a duplicate call. in there.

But certainly there are still the seeds for such things in the code that I don't have -- the code that calls the custom_stc_forms_spx_trial_submit function.  For example, maybe the calling code expects a boolean true return value, though it currently returns NULL (there is no explicit return).

SanfordWhiteman
Level 10 - Community Moderator

Re: syncLead creates duplicate

Great, I'll take a look.

BTW, I am a loyal SC customer!