- Open on Drupal.org βCore: 10.1.4 + Environment: PHP 7.4 & MySQL 8last update
12 months ago Waiting for branch to pass - Issue was unassigned.
- πΊπΈUnited States hyperlinked San Jose, CA
I closed my merge request after realizing that more substantial adjustments would be needed, but these changes could have much farther reaching implications for this module that needs the guidance of someone closer to the source. For now, I'm going to post a patch and explain what I think needs to be done. This patch will work against 3.0 and the 3.0-dev releases.
In Drupal\marketo_ma\Service\MarketoMaServiceApiClient the syncLead method actually corresponds to the push.json endpoint of the Marketo REST API. There is no method corresponding to the leads.json endpoint which is what syncLead should be aligned with. If it doesn't create havoc, syncLead needs to be renamed to pushLead and a new syncLead method should be created.
Note: I will be referring to the REST API endpoints and not any Marketo MA method names to avoid any confusion.
Why is this important? Originally the programName variable was optional for push.json. This made leads.json and push.json interchangeable for single lead actions. At some point, Marketo began throwing errors if you used push.json without a programName, but there doesn't appear to be any part of Marketo MA that's actually setting a programName properly.
The only part of the code where programName is used is in the Webform handler for MarketoMA. You can enter the programName, but it's never used because the Webform Handler bypasses the updateLead methods that would post lead info to leads.json and push.json. Furthermore, the Marketo MA webform handler will collect programName, but if you use programName, you can supply a form ID. Without a form ID, the submission will fail from the Drupal side.
In my attached patch, I've made it so that we have:
syncLead -> leads.json
pushLead -> push.jsonTest coverage and interface updates are included.
- last update
12 months ago Patch Failed to Apply - πΊπΈUnited States hyperlinked San Jose, CA
Updated patch with corrected patch indexing level.
- last update
12 months ago Unable to generate test groups - πΊπΈUnited States neclimdul Houston, TX
So my understanding:
1. Documentation is bad. pushToMarketoUsingPOST requires a program name but doesn't document this requirement. It in fact documents the opposite
programName (string, optional),
2. With formid, program name is bypassed. Maybe not a huge deal but a secondary bug.
3. Without formid, webform calls update lead. Without a program this fails because of #1.The solution is then to provide a push and sync method and choose the correct one based on the program logic?
Marketo really made this so simple!
- Status changed to Needs review
11 months ago 8:24pm 22 January 2024 - πΊπΈUnited States neclimdul Houston, TX
Took a stab at automatically detecting if the program updating resource should be used. Best I can tell this is the right approach but the documentation is very confusing. Let me know if this help.
- Status changed to RTBC
11 months ago 3:13pm 23 January 2024 - πΊπΈUnited States hyperlinked San Jose, CA
Thanks James! I've reviewed the latest commits and I can confirm that I'm able to have my lead data sent to Marketo when a user does something to trigger a lead sync that doesn't involve a program name.
I can also confirm that a Webform submission with a form ID is properly submitted and received by Marketo.
I can't confirm if everything that uses a program name is working properly as I've never used one of those, but I can confirm that the program name when supplied now affects the execution path of the API request whereas before, the program name was always discarded.
BTW, I initially reviewed the wrong branch and I committed some similar changes to the 3.x branch. That commit can be ignored. Everything is in this one already. I'm bad at Gitlab.