create leads in instance B based on the form fill out of instance A?

e873047
Level 1

create leads in instance B based on the form fill out of instance A?

Hi All,

 

We had an issue with form submission, we have taken your blog as reference for submitting the lead in other instance. It's really super helpful. Thanks for providing this.

Your Contribution "Re: Is it possible to create leads in instance B based on the form fill out of instance A?"
 
Issue we are facing, we have 3 instances, i.e. instance A, instance B, instance C. Instance A form will be render in front end, and there is drop down having 3 values like A, B, C, All.
Scenarios1: If the visitor select the drop down as A, lead should create/update in instance A
Scenarios2: If the visitor select the drop down as B, lead should create/update in instance B (but lead should create/update in instance A)
Scenarios3: If the visitor select the drop down as C, lead should create/update in instance C (but lead should create/update in instance A)
Scenarios4: If the visitor select the drop down as All, lead should create/update in instance All instances.
 
Note: we are facing the issue only in Scenario 2 and 3.  If we submit the lead with drop down as B. Then the lead in instance A is also overriding. actually it should not override, only instance B lead should update. 
 
It would be really great if you could you please provide your suggestions on it. It is really urgent please.
 
Sample Code: 
 
<script src="https://app-abm.marketo.com/js/forms2/js/forms2.min.js"></script>
<script>
var mktoFormsLibs2 = {};
mktoFormsLibs2["app-abm"] = MktoForms2;
delete MktoForms2;
</script>
<script src="https://app-ab32.marketo.com/js/forms2/js/forms2.min.js"></script>
<script>
var mktoFormsLibs1 = {};
mktoFormsLibs1["app-ab32"] = MktoForms2;
</script>
<form id="mktoForm_2709"></form>
<form id="mktoForm_1133" style="display:none"></form>
<script>mktoFormsLibs2["app-abm"].loadForm("https://app-abm.marketo.com", "980-EGK-205", 1133); </script>
<script>mktoFormsLibs1["app-ab32"].loadForm("https://app-ab32.marketo.com", "969-NVR-362", 2709, function (form)
{
form.onValidate(function()
{
var svals = form.vals();
if (svals.SBU__c == "SPS")
{
form.submittable(true);
}
else
{
form.submittable(false);
mktoFormsLibs2["app-abm"].whenReady(function(HSMform)
{
HSMform.addHiddenFields({"LeadSource" : "Web Form",
"MarketoBU__c" : "HSM",
});
HSMform.submit();

form.onSuccess(function(values, ThankYouURL) {
document.location.href = 'ThankYouURL';
return false;
});
});
}
});
});

</script>

 

Kindly verify and let me know if you need any additional information.

 

Thanks,

Mahesh