function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jonny.KatesJonny.Kates 

Custom Button - Upload to Constant Contact

Hi all,

 

I'm trying to create a custom button that uploads a contact's details to Constant Contact from within the contact page layout.

 

I can currently upload mass contacts to Constant Contact from a contact list view by using the 'Constant Contact for SalesForce' package (1.6.2). This process involves check-boxing beside any number of contacts in a list, and then adding them to the upload to Constant Contact wizard, which takes care of the rest of the work (onclick Java):

 

var contactIds = {!GETRECORDIDS($ObjectType.Contact)};

if (!contactIds || contactIds.length < 1) {
alert('Please select at least one Contact to upload.');
} else {
var baseUrl;

var hostnameParts = location.hostname.split('.');
if (hostnameParts[0] == 'ctct2') {
baseUrl = 'https://ctct2.' + hostnameParts[1] + '.visual.force.com';
} else {
baseUrl = 'https://ctct2.' + hostnameParts[0] + '.visual.force.com';
}

var form = document.createElement('form');
form.action = baseUrl + '/apex/UploadWizardStep1';
form.method = 'post';

var hiddenTypeField = document.createElement('input');
hiddenTypeField.id = 'type';
hiddenTypeField.name = 'type';
hiddenTypeField.type = 'hidden';
hiddenTypeField.value = 'Contact';
form.appendChild(hiddenTypeField);

var hiddenUploadIdsField = document.createElement('input');
hiddenUploadIdsField.id = 'uploadIds';
hiddenUploadIdsField.name = 'uploadIds';
hiddenUploadIdsField.type = 'hidden';
hiddenUploadIdsField.value = contactIds;
form.appendChild(hiddenUploadIdsField);

document.body.appendChild(form);

form.submit();
}

 

 

However, I want to just add one contact to the upload wizard through process of a custom button on the contact page layout. Any help greatly appreciated.

*werewolf**werewolf*

Well on a contact detail page there's just one contact and you're guaranteed that it's there.  So you can ditch this:

 

var contactIds = {!GETRECORDIDS($ObjectType.Contact)};

if (!contactIds || contactIds.length < 1) {
alert('Please select at least one Contact to upload.');
} else {

 

(obviously get rid of the close curly bracket from that else also)

 

And this:


hiddenUploadIdsField.value = contactIds;

 

should read:


hiddenUploadIdsField.value = '{!Contact.Id}';

SFDC_LearnerSFDC_Learner

HI,

 

As per my exploration, we can upload the contacts and leads from salesforce to constanct contact.

 

But my question is,

 

How can i upload the constant contact emals to salesforce? 

As per my exploration in google, i found it can be possible through REST Api. Can any one has a sample to upload constant contact emails to salesforce?