Thursday 22 August 2013

Salesforce winter'14 Release

Hi friends,

Wait is over !!

Salesforce winter'14 Notes has been released.

Please click here
Salesforce winter'14 Notes

with regards...
Sandeep

Saturday 17 August 2013

How to Rename Home Tab in Salesforce

Hi Folks,

On force.com community I was asked about renaming Home Tab in Salesforce. I have figured it out using home page component. Home page component is very useful tool for applying customization over standard layouts up to some extent.
Here is Home Tab normally




In order to implement this I have just created a Home page component and put it on requested home page layout. Here is piece of code


After Applying this Home page component, Home tab would looking like below:


Thanks for reading this article.

Sunday 4 August 2013

How to send Email from Apex code with controlling 'From Address' & Sender's Name Dynamically

Hi friends,

Today I came up with one interesting thing to share with you. Generally we send emails from Salesforce using following ways :-
1. Apex Code
2. Email Alerts
3. Outbound messaging etc.

In all of these ways we normally set 'To'/'Cc'/'Bcc' but have you thought how to control 'From address of email'? what to do if we need to send email displaying any other email address in 'from' part instead of sender's email address. Here is one Salesforce feature to get rid of this problem that is "Organization-Wide Email Addresses".


In above screen shot you just need to
1. Navigate Setup -> Email Administration ->  Organization-Wide Email Addresses
2. Click on Add button.
3. Enter email Id and display name of sender.
4. In order to complete this process you need to get verified email id you are putting here ( in this example it is 'testuser@gmail.com').

Now it is ready for use. Let's see how we can use it in Apex code side:-

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();  
string body = 'Hi ';
String[] toAddresses = new String[] {'sksworld10@gmail.com'}; 
mail.setToAddresses(toAddresses);
mail.setSubject('Test Subject');  
mail.setSaveAsActivity(false);  
for(OrgWideEmailAddress owa : [select id, Address, DisplayName from OrgWideEmailAddress]) 
{
 if(owa.Address.contains('testuser')) 
  mail.setOrgWideEmailAddressId(owa.id); 
}
mail.setHtmlBody(body);  
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });


Here you can notice that we can control 'From address' in sending email.

Thanks for reading this article.