Be Good & Do Good!

Year: 2009 (Page 2 of 15)

Don’t be serious, be sincere

Don’t just have career or academic goals. Set goals to give you a balanced, successful life. I use the word balanced before successful. Balanced means ensuring your health, relationships, mental peace are all in good order.

There is no point of getting a promotion on the day of your breakup.
There is no fun in driving a car if your back hurts.
Shopping is not enjoyable if your mind is full of tensions.

“Life is one of those races in nursery school where you have to run with a marble in a spoon kept in your mouth. If the marble falls, there is no point coming first. Same is with life where health and relationships are the marble. Your striving is only worth it if there is harmony in your life. Else, you may achieve the success, but this spark, this feeling of being excited and alive, will start to die. ………… …….

One thing about nurturing the spark – don’t take life seriously. Life is not meant to be taken seriously, as we are really temporary here. We are like a pre-paid card with limited validity. If we are lucky, we may last another 50 years. And 50 years is just 2,500 weekends. Do we really need to get so worked up? ………… ….
It’s ok, bunk a few classes, scoring low in couple of papers, goof up a few interviews, take leave from work, fall in love, little fights with your spouse.

We are people, not programmed devices….. ….” 🙂

– Chetan Bhagat

Salesforce Cheat Sheets

Following is list of cheat sheets, covering Apex code, Visualforce, the Force.com Web Services API and formulas, are concise reference guides to each of these technologies – summarizing the most important aspects of each technology in a compact, searchable and printable form.

The resources listed below provide access to the most recent version of the online cheat sheet, as well as to the most important reference material.

App Logic: Apex Code Cheat Sheet

App Logic: Formulas Cheat Sheet

User Interface: Visualforce Cheat Sheet

Integration: Web Services API Cheat Sheet

Salesforce – S-controls will be phased out?

Yes, that is true, by the end of 2009 I think. You can now do in Visualforce everything that you could have done in an Scontrol, and faster and more securely to boot.

Q1: Does your answer that “S-controls will be phased out” mean that existing, older instances of SalesForce will be forced to REPLACE existing S-controls that provide useful functionality? In other words, will these STOP functioning?
A: No, existing S-controls will continue to function

Q2: will the inability to use S-controls be limited to NEW instances of SalesForce?
A: I believe the inability to create new S-controls will apply to all instances.

Q3: If the answer to question 1 is that existing S-controls will CONTINUE to function, then will revisions of those S-controls be prohibited?
A: I’m not sure, but I think the answer is no — you can modify old S-controls but can’t create new ones

Salesforce – VisualForce Pagination with Apex

Following are two posts from Jeff Douglas and Richard Vanhook nicely illustrating with sample code on how to develop the pagination using Apex.

Salesforce.com introduced the StandardSetController in Winter ‘09 and Jeff documents the new pagination feature as pretty powerful and easy to use with standard as well as custom objects. Read More @
http://blog.jeffdouglas.com/2009/07/14/visualforce-page-with-pagination/

Pagination in VisualForce is a frequently occurring requirement for force.com developers. While the platform includes a native api for pagination in the StandardSetController class, it’s fairly inflexible; especially for complex pagination. And just as important, the native api supports pagination with sObjects only, so if you want to show pages of “plain old apex objects”, you’re out of luck. In his blog entry, Richard introduces us to pagination in apex-lang via a concept called “paginators. Read More @
http://richardvanhook.wordpress.com/2009/08/03/visualforce-pagination-with-apex-lang/

Submit a Form in Internet Explorer with Enter

Ran into an (other) interesting Internet Explorer bug. Seems that if you have a form with only a single text input, hitting the enter button will not submit the form in IE.

<form action="" method="post">
<fieldset>
<label for="user_name">User Name</label>
<input type="text" name="user_name" id="user_name" />
</fieldset>
<fieldset class="button">
<button type="submit" name="submit" id="submit" title="Verify User Name">Verify User Name</button>
</fieldset>
</form>

The solution is to hide an additional disabled input for IE to find, using IE conditional Comments and hiding it from view with some CSS.

<form action="" method="post">
<fieldset>
<!--[if IE]><input type="text" style="display: none;" disabled="disabled" size="1" /><![endif]-->
<label for="user_name">User Name</label>
<input type="text" name="user_name" id="user_name" />
</fieldset>
<fieldset class="button">
<button type="submit" name="submit" id="submit" title="Verify User Name">Verify User Name</button>
</fieldset>
</form>

Workbench in a Web Tab inside Salesforce.com for single sign-on

The Workbench has exposed an API to allow users to automatically log in to the Workbench by providing their Server URL and Session Id in the URL arguments. This can be to integrate the Workbench into a Web Tab directly in Salesforce for single sign-on into the Workbench.

To integrate the Workbench into your org, follow the instructions below:

  1. Login to Salesforce
  2. Setup | Create | Tabs | Web Tabs | New
  3. Choose Tab Layout (Full page width is recommended)

Define Content and Display Properties

  1. Tab Type: URL
  2. Tab Label: Workbench
  3. Tab Tab Style: Choose a style
  4. Content Frame Height (pixels): Choose the maximum amount available for your screen (you may have to edit this value to find the correct value for your screen)

Button or Link URL

  1. Button or Link URL (replace "<your_server>" with the web server the Workbench in installed): https://<your_server>/workbench/login.php?serverUrl={!API_Partner_Server_URL_150}&sid={!API_Session_ID}
  2. Encoding: Unicode UTF-8

Save

Salesforce – Steps to Schedule/Reschedule Apex (Apex Scheduler)

Steps to Schedule Apex

  1. Define Scheduled Apex Class
  2. global class scheduledMerge implements Schedulable{
    global void execute(SchedulableContext SC) {
    mergeNumbers M = new mergeNumbers();
    }}

  3. Run the system.schedule Anonymous Code to Schedule the Apex Class (Read More on System.Schedule @ http://tinyurl.com/yg2d7qj)
  4. Setup | Monitoring | Scheduled Jobs to list the above Scheduled Job

Steps to Update Scheduled Apex Code

  1. Delete the Scheduled Job from Setup | Monitoring | Scheduled Jobs
  2. Edit/Update the underlying Apex Class. (Save will result in “the class has pending jobs” error, if you haven’t deleted the Scheduled Job i.e., STEP1 is prerequisite for this STEP2)
  3. Run the Anonymous Code to Schedule the Apex Class (system.schedule)
  4. Setup | Monitoring | Scheduled Jobs to list the above Scheduled Job

HTML Email Tracking in Salesforce

Outbound HTML emails are tracked by default if your organization uses HTML email templates. You can select or deselect this setting at Setup | Customize | Activities | Activity Settings to control email tracking. If you disable email tracking, email tracking information for your organization is no longer stored. However, the HTML Email Status related list remains on page layouts and email tracking reports remain on the Reports tab.

After sending an HTML email, you can track the date it was first opened, the number of times it was opened, and the date it was most recently opened.

Salesforce.com – Apex Web Service Callout Using @future

Jeff

The addition of asynchronous Web service callouts to external services is a feature that developers have been requesting for quite awhile in Salesforce.com. Using the new @future annotation, your methods execute the callout when Salesforce.com has resources available. One of the great benefits is that it allows you to perform callouts during trigger executions.

Today, I developed the callouts from trigger. There are many limitations which I came across and which are documented very well by Jeff on his blog post http://blog.jeffdouglas.com/2009/03/16/restful-web-service-callout-using-post/

I kept on trying to use complex data types, unless i reached Jeff post and found that only primitive data types are supported in future methods. To paraphrase, following are the points to be taken note of when using the future annotation:

  • No more than 10 method calls per Apex invocation
  • No more than 200 method calls per Salesforce license per 24 hours
  • The parameters specified must be primitive dataypes, arrays of primitive datatypes, or collections of primitive datatypes.
  • Methods with the future annotation cannot take sObjects or objects as arguments.
  • Methods with the future annotation cannot be used in Visualforce controllers in either getMethodName or setMethodName methods, nor in the constructor.

Also good note of points about asynchronous call outs can be read at Salesforce Blog

  • Like any asynchronous method. the callout must be in a static method and return a void type.
  • The system executes the asynchronous call when it has available resources – this means that you can’t assume anything about when the call will be executed.
  • The asynchronous method executes in a different transaction context than the trigger. A failure of the callout will have no effect on the transaction controlling the trigger (i.e. changes will not be rolled back). You will have to build in suitable compensation logic yourself to account for any exceptions in the callout.
  • Keep the governor limits in mind when making callouts. We are constrained by the interface provided by the remote web service. If the remote web service were to provide any kind of batch processing interface, choose that instead of making individual calls. It helps avoid hitting the governor limits and will be more performant as well since there are fewer round trips to make.
« Older posts Newer posts »