Ye Meri Life Hai - Chirag Mehta

Be Good & Do Good!

Month: April 2010

Is Aamir a Marketing Genius …

Aamir can give lessons in film marketing at top B-schools globally.

Some cases in point:

  • Ghulam (Aamir promoted the train stunt),
  • Ghajini (got down to giving kids the buzz cut in Delhi),
  • Fanaa (landed up to support Narmada Bachao Andolan),
  • Taare… (activities with Darsheel Safary),
  • Lagaan (Oscar buzz), and
  • 3 Idiots (vanished only to emerge in disguise on an all-India road tour).

He sticks to the brands which he endorses
He is a perfectionist ..
He delivers what he promises
He has an intellectual image

At end, he is classy ……

How to format a date in VisualForce?

Problem Statement
In Salesforce, if I’m binding a date into a VisualForce page, how do I apply custom formatting to it?

Example:

<apex :page standardController=”Contact”>
</apex><apex :pageBlock title=”Test”>
<p>{!contact.Birthdate}</p>
</apex>
<apex :detail relatedList=”false” />

This will output a date in the default format:

Thu Jul 01 09:10:23 GMT 2009

How do I get it (for example) into dd/mm/yyyy format, like this:

01/07/2009

Solution

<apex :outputText value=”{0,date,MM’/’dd’/’yyyy}”>
<apex :param value=”{!contact.Birthdate}” />
</apex>

Solution

Source : StackOverflow.com

Salesforce – Restrict emails on new case, task, password reset …

The Salesforce.com user interface allows you to specify whether or not to send an email when the following events occur:

Creation of a new case or task
Creation of a case comment
Conversion of a case email to a contact
New user email notification
Password reset

In Apex scripts saved against API version 15.0 or later, the Database.DMLOptions emailHeader method enables you to specify additional information regarding the email that gets sent when one of the events occurs because of the script’s execution.

The following are the options that can be set with the emailHeader method:

  1. triggerAutoResponseEmail : Indicates whether to trigger auto-response rules (true) or not (false), for leads and cases. In the Salesforce.com user interface, this email can be automatically triggered by a number of events, for example creating a case or resetting a user password. If this value is set to true, when a case is created, if there is an email address for the contact specified in ContactID, the email is sent to that address. If not, the email is sent to the address specified in SuppliedEmail.
  2. triggerOtherEmail : Indicates whether to trigger email outside the organization (true) or not (false). In the Salesforce.com user interface, this email can be automatically triggered by creating, editing,or deleting a contact for a case.
  3. triggerUserEmail : Indicates whether to trigger email that is sent to users in the organization (true) or not (false). In the Salesforce.com user interface, this email can be automatically triggered by a number of events; resetting a password, creating a new user, adding comments to a case, or creating or modifying a task.

In the following example, the triggerAutoResponseEmail option is specified:

Account a = new Account(name=’Acme Plumbing’);
insert a;
Contact c = new Contact(email=’jplumber@salesforce.com’, firstname=’Joe’,lastname=’Plumber’,accountid=a.id);
insert c;
Database.DMLOptions dlo = new Database.DMLOptions();
dlo.EmailHeader.triggerAutoResponseEmail = true;
Case ca = new Case(subject=’Plumbing Problems’, contactid=c.id);
database.insert(ca, dlo);

Visualforce – Adding History related list to Tabbed Account

Problem Statement
Has anyone been able to generate the “account history” tab in visualforce page? If i try using “Histories” in <apex:relatedList>, I get error msg saying it is not valid child relation name..

Solution1
This works for me to add a link to the account field history:

<apex:tab label=”Field History” name=”Field History” id=”fieldhistory”>
<apex:outputLink value=”https://na1.salesforce.com/_ui/common/history/ui/EntityHistoryFilterPage?id={!account.id}”>
click to view field history
</apex:outputLink>
</apex:tab>

Not optimum as user has to click the link but you dont need to do a lot of work.

Solution2
I also figured out how to access the Account History data. It is NOT a related list. Instead, use the code <apex:dataTable> to pull from the account.histories table. Below is rough code that will pull the Account History into a separate tab. The HTML formating is not very clean, but the data query works!:

<apex:tab label=”Field History” name=”Account History” id=”fieldhistory” >
<apex:dataTable value=”{!account.histories}” var=”accounthistory” id=”HistTable” rowClasses=”odd,even”
styleClass=”tableClass” cellspacing=”15″ width=”80%”>
<apex:facet name=”caption”></apex:facet>
<apex:facet name=”header”>Field History</apex:facet>
<apex:facet name=”footer”></apex:facet>
<apex:column>
<apex:facet name=”header”>Edit Date</apex:facet>
<apex:facet name=”footer”></apex:facet>
<apex:outputText value=”{0,date,MM/dd/yyyy HH:mm }”>
<apex:param value=”{!accounthistory.createddate}” />
</apex:outputText>
</apex:column>
<apex:column>
<apex:facet name=”header”>Field</apex:facet>
<apex:facet name=”footer”></apex:facet>
<b> <apex:outputText value=”{!accounthistory.field}”/></b>
</apex:column>
<apex:column>
<apex:facet name=”header”>Edited By</apex:facet>
<apex:facet name=”footer”></apex:facet>
<apex:outputText value=”{!accounthistory.createdby.name}”/>
</apex:column>
<apex:column>
<apex:facet name=”header”>Old Value</apex:facet>
<apex:facet name=”footer”></apex:facet>
<apex:outputText value=”{!accounthistory.oldvalue}”/>
</apex:column>
<apex:column>
<apex:facet name=”header”>New Value</apex:facet>
<apex:facet name=”footer”></apex:facet>
<apex:outputText value=”{!accounthistory.newvalue}”/>
</apex:column>
</apex:dataTable>
</apex:tab>

Source : Salesforce Community

URL to export(download) Salesforce Report

Problem Statement
It may be possible that sometime you need to code or provide a link to directly download a report.

Solution
In order to directly export a report, navigate to following URL. This URL request will prompt you with open/save dialog to export the report.

ExportReport

Here,

https://na1.salesforce.com is Salesforce hostname on which the org is hosted
00O30000001Y9ll is report Salesforce ID
export=1 is the parameter required to request system for direct download of report

Also note that,

Salesforce out of box feature does allow exporting of report, but its 3 step process
Navigate to report
Click Export Details
Click Export

Salesforce – VMware to announce “VMForce”

What’s the story behind “Salesforce – VMware to announce VMForce”. Salesforce is advertising loudly something as follows …

Join industry leaders Marc Benioff, chairman & CEO of salesforce.com, and Paul Maritz, president & CEO of VMware, for a live Webcast where they will make an exciting joint product announcement on the future of cloudcomputing.

VMforce is ComingMarc - Paul

Date: April 27, 2010
Time: 10:30 a.m. PDT
Location: www.vmforce.com

We got only thing to do is to wait and watch ..
What is VMforce all about and to what level will it transform the CLOUD world …

About Salesforce & VMware
Logos
Salesforce.com is the world’s biggest provider of software that is delivered via the Web.
VMware is the top maker of virtualization programs that allow companies to boost the efficiency of computer hardware by running multiple virtual machines on a single piece of equipment.

How to Deep Link to a Specific Point in a YouTube Video

There are hundreds of videos on YouTube which contain valuable best practice content. To help surface the golden nuggets here are three ways to deep link to specific places within the video.

1. Create a link to a specific part in a YouTube video

If you want to link to a specific part of a video on YouTube, you can. For example,
http://www.youtube.com/watch?v=PjDw3azfZWI#t=31m08s

Notice the “#t=31m08s” on the end of the url? That link will take you 31 minutes and 8 seconds into that video. Linking to a particular minute and second can be really helpful — for example, that link takes you straight to where someone asks Eric Schmidt a question about Twitter. From there, you can listen to his answer, where he says (among other things): “We’re in favor of all of these new communications mechanisms. ….”

2. Start an embedded YouTube at a certain timestamp

To do it on an embedded video, use the “start” parameter. Note that start takes seconds as a parameter, not minutes and seconds. For example, to start an embedded video 31 minutes and 8 seconds into a video, 31*60+8 = 1868 seconds, so you would use this code:
<object width=”640″ height=”385″><param name=”movie” value=”http://www.youtube.com/
v/PjDw3azfZWI&hl=en_US&start=1868″></param><param name=
“allowscriptaccess” value=”always”></param><embed src=”http://www.youtube.com
/v/PjDw3azfZWI&hl=en_US&start=1868″ type=”application/x-shockwave-flash” allowscriptaccess=”always” width=”640″ height=”385″></embed><
/object>

3. Use annotations to create links within your videos

Read more on how to create and use annotations at http://www.youtube.com/watch?v=CDsLSFKwgFI

How to export data to CSV file/text file using Apex

Problem Statement
I want to export list of object into CSV file using Apex

Solution

<apex:page controller="csvController" cache="true" 
contentType="text/csv#filename.csv" language="en-US">
"Col A","Col B","Col C","Col D"
<apex:repeat value="{!myList}" var="a">
"{!a.ColA}","{!a.ColB}","{!a.ColC}","{!a.ColD}"
</apex:repeat>
</apex:page>

Please note that

  • With the #filename.csv, it prompts the user to save/open the file. Otherwise, it loads into the browser as html
  • You’ll also have to format the VF page as a clean csv text file, that means no pageblocktables or anything that might insert html formatting.
  • if customer want to export data object to text file use contentType=”text/plain”

Source : Salesforce Community

Indian company to create call center jobs in the US

There is one word used over and over again in India to describe JustDial

http://tctechcrunch.files.wordpress.com/2010/03/mani_just_dial_01.jpg?w=300&h=199

The idea is simple: You call up and within the first ring a real person picks up the phone, you ask them for any business listing – in any category – and within 45 seconds they email or text you the information or, if you prefer, connect the call.

The company will end its fiscal year at the end of March with some $32 million in revenues having answered 72 million calls in the last year. That call volume is increasing by 40%, so the company expects to break 100 million calls in the next year. In a country where nearly everyone has a mobile phone but just 50 million people have Internet access, JustDial is essentially Google and 411 rolled together.

The move is a direct volley at a service like GOOG-411, which has opted to do the same thing, but using voice recognition software. But Founder and CEO V.S.S. Mani (pictured above, in one of his call centers) is betting that nothing beats a human voice with a quick answer.

For now, JustDial’s US operations will be handled out of India, where the company employs some 4,000 people but, in a twist to the direction most call center jobs are flowing, Mani plans to hire up big in the US—up to 1,000 people mostly in under-employed, rural areas. “We need a big presence in the US very soon,” Mani says. That right– an Indian company will be creating call center jobs in the US