+ Start a Discussion

Pushing and updating lead information

We currently send leads from one org to another using a custom link-  web-to-lead call (see below).
This, however only pushes the data out, leaving the custom link exposed to be pushed again on the same lead (read "duplicates").
To control we restrict use to admin(s) who, after each call, manually changes the record type to hide the link.
Can  it be set-up to both send the leads info out and then change the record type automatically.
Then the reps can send their own leads but only once.
Any assistance/direction would be greatly appreciated:

Have you tried using Scontrol instead of weblink ?

You could have the Scontrol update the leads record type and then make a http post to web2lead servlet...


Not too code too savvy (yet), so if there are examples out there that can be used that would be great?

Message Edited by lpadmin on 10-04-2006 03:09 PM



OK, got the lead update code, but having issues incorporating the 2 elements in to a single S-control "call".

2 distinct functions, (Web2Lead : Record Update)

1 Single Click

Any assistance would be greatly appreciated.

Here is where I am :

HTML Body <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js"
<script language="javascript">
function init()
// For using the Sandbox account.
var ir = sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", true);

function goBack(Id) {
// This brings me back to the Objects overview page if an Object Id is given.
var r = "{!Scontrol_URL}".split(/salesforce.com/);
var whichId = "";
if (Id != null) whichId = Id;
var returnUrl = r[0] + "salesforce.com/"+whichId;
window.parent.parent.location.href = returnUrl;

function doit()
// Debugging. A place to set breakpoints.
// alert("FYI: sforceClient.getLoginUrl = " + sforceClient.getLoginUrl());

//Creating a DynaBean for the case
var myCase = new Sforce.Dynabean("Lead");
//changing and updating the lead status
myCase.set("Id", "{!Lead_ID}");
myCase.set("Status", "Transferred to BCOOL");
myCase.set("RecordTypeId", "0120000000001Eq");
var saveResults = sforceClient.Update(myCase)[0]; // Returns an array of results.
if (Sforce.Util.dltypeof(saveResults) != "SaveResult" ||
saveResults.success == false ) {
alert("Error updating Case " + saveResults);
<body onLoad="init();">
Updating Status...
<a href="http://ssl.salesforce.com/servlet/servlet.WebToLead?debug=yes&oid=xxxxxxxxxxxxxxx&retURL=www.salesforce.com&first_name={!Lead_firstname}&last_name={!Lead_lastname}&company={!lead_company}&city={!lead_city}&state={!lead_state}&phone={!lead_phone}&zip={!lead_postalcode}&street={!lead_address}&description={!Lead_Sales_Rep_Comments}&lead_source="Optimum Lightpath Sales Referral"&Industry={!Lead_Industry}&lead_type={!lead_lead_type}&email={!lead_Email}&title={!Lead_Title}"onMouseOver="alert('Your Message here'); return true;"> Link Text Goes here </a>


Message Edited by lpadmin on 10-18-2006 07:55 PM

You could do the most easiest thing ...if you are running the scontrol within SFDC frame.. open a new window - you can set params if needed as follows ...


so this would post it and you can redirect the web2lead to ur website...


Change the href of the window..

window.parent.location.href = openURL;

where openURL is your http post servlet url...

so if you are opening up the Scontrol in a pop up window.. you could do it directly in that window instead of opening a new window...

Hope this helps..