Ye Meri Life Hai - Chirag Mehta

Be Good & Do Good!

Category: Salesforce (page 4 of 11)

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 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

Ability to create alias for field labels across Profiles

Problem Statement
We have users in multiple countries and different vernacular for the same entity. Is it possible to create an alias for a record type that displays for users with a specific profile so we can use the same record types and records, yet have the customization between different countries? It’s almost like using translations, but it’s all within the English language.

Example: Record Type “Municipality” vs. “Local Authority” for same records
Everyday users see Municipality
UK users see Local Authority

Possible Solutions

Terrence: Look at the new Translation Workbench feature. The Translation Workbench allows you to create translations for the customizations you’ve made to your Salesforce.com organization. Everything from custom picklist values to custom fields can be translated so your global users can use all of Salesforce.com in their language.
Go to Setup | Admin Setup | Translation Workbench.

Tom: You may also be able to utilize the Tags function. Setup / Customize / Tags.
This would enable each user to “tag” the field with the name that they are comfortable with. That would help them with the different names in different areas.

Paul: Unfortunately I don’t see how either of these options will work. The translation workbench does not specify English and English (UK) as two different languages, and I imagine if you set someone’s language to another language like Spanish then all of the standard tabs and fields are in that language. I don’t see how to change the translations for standard tabs and fields in the workbench.

The tag feature is for tagging records, it does not allow you to tag fields, and it has to be done for each record.

I think you have two options:

One option is just to make all the fields have both names, like State/Province. In your example just rename the field Municipality/Local Authority. You can even rename standard fields under Setup > Customize > Tab Names and Labels. RECOMMENDED Solution

Your other option is to create two fields for each one that you want to modify. Setup a workflow rule or trigger that automatically updates the matching field whenever it’s entered. Then create two different page layouts that are used based on the user’s profile (so UK users would have to have a different profile from US users).

Depending on the number of fields that you’re talking about, the second one could get really complicated.

Discussion @ Salesforce Linked In

Salesforce – FTP Integration (Data loader, Web service & HTTP)

Author : Chirag Mehta & Angelica Buffa

Using FTP servers to store and share files is very common now at days. Most language programs let you develop FTP clients and consume their services.

With Apex, there are three possible approaches to resolve the integration with this kind of file servers:

I – Data Loader CLI – Windows approach.

  1. Download Salesforce Data Loader Command Line Interface (Read more at http://wiki.developerforce.com/index.php/Using_Data_Loader_from_the_command_line)
  2. Write a Widows Batch file (.bat file)
  3. First command in the batch file will be connect to FTP server (ms-dos command ‘ftp’) and then get the necessary files from ftp server to the local folder.
  4. Second set of commands execute the Data Loader CLI jar and loads step3 retrieved file into Salesforce.
  5. To automate the execution of the batch, we can schedule the bat file execution using scheduled task feature of Windows operating system.

II – Java Web Service

  1. Write a Java FTP client, expose it as a Web Service
  2. Consume above WS into your Salesforce Org using Apex “Browse WSDL” functionality

III – Http Request

  1. Create a Http Request to the FTP server
  2. Handle the response using either of HttpRequest and HttpResponse Apex Class
  3. Ps: The problem that you can face is the size of the files. Please remember that HTTP Request size are currently limited to 100Kb of data, so larger exports would fail unless a mechanism was created to utilize multi-part transmissions.

How to configure Lotus Connect & Single Sign-On in a CITRIX Env

From last few days, I have been exploring  to find out how to configure(implement) Salesforce Lotus Connect & Single Sign-On in a CITRIX environment. Salesforce Support when contacted provided a displeased reply …

Case Description

Please highlight step by step process on how to configure (implement) Lotus Connect and Single Sign-On in a CITRIX enviornment

Case Comment from Salesforce

Unfortunately we do not support citrix, so I may not be able to fully assist you with your case.

1. – Lotus Notes – I unfortunately do not have any information regarding the installation of connect for lotus notes in a citrix enviroment. If you consult the web boards at Developer.Force.Com and Community.Force.Com you may be able to find more information.

2. -SSO – We do have information regarding SSO, but we do not have any specifically designed for citrix. This is the information we have:
https://na1.salesforce.com/help/doc/en/salesforce_single_sign_on.pdf
https://na1.salesforce.com/help/doc/en/sso_about.htm

Any possible solutions or workarounds on how to configure Lotus Connect & SSO in a citrix env?

Callout from scheduled Apex not supported

Problem
Apex code with callouts doesnt works when scheduled. After requesting the debug logs, I could see the following:

EXCEPTION_THROWN|[45,19]|System.CalloutException: Callout from scheduled Apex not supported.

Solution

You need to use the @future annotation. Refer Salesforce Blog for an example

Webinar : Salesforce Chatter Developer Preview Tech Talk

http://wiki.developerforce.com/images/thumb/c/ca/Chatterlogo.gif/100px-Chatterlogo.gifSalesforce Chatter is a new collaboration platform that lets you build collaborative cloud-computing applications on Force.com, applications enhanced with rich user profiles, status updates, feeds for monitoring applications and users, and more. In this webinar you will:

Watch the webinar, and learn about Chatter Developer Preview:

  • Understand the rich and powerful Chatter features
  • Get to see a demo illustrating the value of Chatter
  • Learn about the tools for customizing your apps with rich social media

    Older posts Newer posts