Send Marketo Email button and SFDC Lightning | Community
Skip to main content
Level 2
January 31, 2017
Question

Send Marketo Email button and SFDC Lightning

  • January 31, 2017
  • 2 replies
  • 7933 views

Marketo's "Send Marketo Email" button with the Marketo Sales Insight package is not supported by SFDC Lightning because they are javascript based. This means the buttons will not appear when using the Lighting UI in SFDC. Does anyone know of a work around until Marketo addresses this issue?  I know our users can change their UI back to the SFDC classic UI and use the buttons, but that's not the ideal situation. Our users would prefer to say within one UI.

thanks in advance.

p

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Grégoire_Miche2
Level 10
February 1, 2017

Hi Petyr,

Are you sure you have upgraded to the lastest version of MSI?

On my instance, it works well:

My MSI version number is 1.4359.2

-Greg

PetyrCaAuthor
Level 2
February 6, 2017

Hi @Grégoire,

thanks for the response. Looks like I have an older version of MSI 1.4359.1. I'll have to install the newer version.

thanks

p

Grégoire_Miche2
Level 10
February 6, 2017

Hy Petyr,

Pls mark it as responded.

-Greg

Danielle_Wright
Level 2
October 19, 2018

In case anyone else stumbles across this, here's my solution:

Build a visualforce page with this code for contacts:

<apex:page standardController="Contact" recordSetVar="AllContacts">

<apex:includeScript value="/soap/ajax/30.0/connection.js"/>

<apex:includeScript value="/soap/ajax/30.0/apex.js"/>

<script>

sforce.connection.sessionId = "{!$Api.Session_ID}";

var idArr = [];

list = "{!Selected}"

list = list.replace("[","").replace("]","")

idArr = list.split(", ");

if (idArr[0] == null){

  alert('Please select at least one row');

}

else {

  var value = new Array();

  value[0] = new String(idArr);

  var mname = new Array();

  mname[0] = "contactIds";

  var key =

    sforce.apex.execute(

        "mkto_si.LongGetMethodArguHandler",

        "putArgus",

        {

            name : mname,

            value : value,

            contactType : "Contact"

        }

    );

try {

var key = sforce.apex.execute("mkto_si.LongGetMethodArguHandler", "putArgus", { name:mname, value:value, contactType:"Contact" });

window.top.location = "/apex/mkto_si__Send_Marketo_Email?contactType=Contact&key=" + key +"&retUrl=" + encodeURIComponent(document.location.href);

}

catch(err) {

window.top.location = "/apex/mkto_si__Send_Marketo_Email?contactType=Contact&contactIds=" + idArr +"&retUrl=" + encodeURIComponent(document.location.href);

}

}

</script>

</apex:page>

Or this code for leads:

<apex:page standardController="Lead" recordSetVar="AllLeads">

<apex:includeScript value="/soap/ajax/30.0/connection.js"/>

<apex:includeScript value="/soap/ajax/30.0/apex.js"/>

<script>

sforce.connection.sessionId = "{!$Api.Session_ID}";

var idArr = [];

list = "{!Selected}"

list = list.replace("[","").replace("]","")

idArr = list.split(", ");

if (idArr[0] == null){

  alert('Please select at least one row');

}

else {

  var value = new Array();

  value[0] = new String(idArr);

  var mname = new Array();

  mname[0] = "contactIds";

  var key =

  sforce.apex.execute(

  "mkto_si.LongGetMethodArguHandler",

  "putArgus",

  {

  name : mname,

  value : value,

  contactType : "Lead"

  }

  );

try {

var key = sforce.apex.execute("mkto_si.LongGetMethodArguHandler", "putArgus", { name:mname, value:value, contactType:"Lead" });

window.top.location = "/apex/mkto_si__Send_Marketo_Email?contactType=Lead&key=" + key +"&retUrl=" + encodeURIComponent(document.location.href);

}

catch(err) {

window.top.location = "/apex/mkto_si__Send_Marketo_Email?contactType=Lead&contactIds=" + idArr +"&retUrl=" + encodeURIComponent(document.location.href);

}

}

</script>

</apex:page>

Then create a new list view button with your visualforce page as the content source:

Then add the new button to the list view.

It takes a second to load, same as the classic button, but because you're sitting on the visualforce page instead of the list, I also added a "One moment please...." message to the page to pacify impatient users.

Hope that helps someone in the future.

SanfordWhiteman
Level 10
October 19, 2018

Better to highlight your code so it's readable using the Advanced Editor's syntax highlighter. (And thanks for the contribution.)

https://s3.amazonaws.com/blog-images-teknkl-com/syntax_highlighter.gif

Danielle_Wright
Level 2
October 19, 2018

I updated to make it formal and readable.