Monday, December 1, 2014

Html5 Drag and Drop, simple move

For intro to drag and drop refer to w3schools. The following snippets are from w3schools.
function allowDrop(ev) {
    ev.preventDefault();
}
function drag(ev) {
    ev.dataTransfer.setData("text", ev.target.id);
}
function drop(ev) {
    ev.preventDefault();
    var data = ev.dataTransfer.getData("text");
    ev.target.appendChild(document.getElementById(data));
}
<div id="div1"></div>
    <img id="drag1" draggable="true" src="http://projectsuperior.com/dnd/Logo1.png"  ondragstart="drag(event)" width="100" height="100"/>
<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
To read further ...

Friday, November 28, 2014

Salesforce - Mass email Contacts using Visualforce email template

Today, we will illustrate how you can send up to 1000 emails to contacts using a Visualforce email template. 

1. Create Visualforce email template in your Salesforce.com instance:
    Go to Setup < Communication Templates < Email Templates and click "New Template"

2. Select Visualforce.

 3. Enter Required information and chose Contact as your "Recipient" and "Related To" types.

4. Edit your template.

5. Now, you have different options to leverage this email template.

  • Create a custom Visualforce page, and a custom controller that you will use as a list button in the Contact tab.
  • Write a script and run it through Execute Anonymous in Eclipse or the Developer Console.

Today, we will be using the latter option:

We will create a list with contacts that we will send the emails to (max. 1000). Then we will create a batch of emails. After that we will send the emails to the recipients.

// List that will store emails that will be sent
List allMails = new List(); 

// list of contacts
List contacts = [Select id, Email, LastName from Contact Limit:1000]; 

// Email Template
EmailTemplate myEMailTemplate = [Select id from EmailTemplate where Name =: 'Test Template']; 

// emails are being created and stored in list
for(Contact c: contacts){ 
   
    Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
email.setTemplateId(myEMailTemplate.id);
email.setTargetObjectId(c.id); 
email.setSenderDisplayName('Sender Display Name'); 
    allMails.add(email);
 }

// send emails, false makes sure that the method will not stop when an error occurred, such as a bounced email
Messaging.sendEmail(allMails, false); 

Monday, November 24, 2014

Salesforce Mass emailing using Visualforce Page

Salesforce governor limits and other restrictions can stress every developer. Mass emails can be sent to up to 1000 contacts or leads per day using HTML or Text email templates. One cannot mass email contacts using custom Visualforce email templates.

Imagine, you create a nice visualforce email template using custom components, controllers, styles, images, etc. Then you discover that you will not be able to use your custom visualforce email template to send mass emails.

In our next post we will illustrate how to work around this issue...

We will also package the code and post it in the salesforce app market as a free download.

Stay tuned!

Sunday, November 23, 2014

Hashtag trends

Last Friday, Nov 21, launched hourly tweets for top trends on certain keywords.
Check us out on http://projectsuperior.com

Web presence

You may ask yourself how you can reach out to project Superior...

Email: contact@projectSuperior.com
website: www.projectsuperior.com
twitter: @projectSuperior
facebook: facebook.com/projectSuperior

project Superior is online...

project Superior is a Colorado  based team of talented, experienced and motivated software architects and engineers. project Superior provides high quality services in:
  • Web and Backend Development
  • Salesforce.com development
  • Social Media Streaming and Analysis - Twitter Intelligence
  • Network System installation
We offer special rates for students and non-profits. Contact us for more information.

You may ask yourself how you can reach out to project Superior...

twitter: @projectSuperior