Friday, November 4, 2011

Salesforce How to Debug / Troubleshoot using the Salesforce Debug Logs

Setting up your user for Debug Log monitoring
  1. Name / Setup / Administration Setup / Monitoring / Debug Logs
  2. Click ‘New’.
  3. Select your User from the lookup. Click 'Save'.
    1. Your user is now setup to monitor and record a debug log for every page load of a visualforce page in salesforce. These logs can be viewed or downloaded for review.
    2. You get 20 Debug Log requests at a time... this is to prevent stacking up a bunch of unused logs, so whenever you are done using the debug logs, remove your User from the list to monitor debug logs, or click 'Reset' next to your User and it will give you a fresh 20 requests. Otherwise your name will be automatically removed from the list to monitor debug logs once you reach your 20 request limit.
Using the Debug Log

Tuesday, July 26, 2011

Preventing focus of first input field and Calendar widget on page load in Salesforce

Sometimes in salesforce visualforce pages, the first input field on the page will automatically be set to focus on page load. This can be very annoying and confusing to a user, sometimes scrolling the page to the far right, halfway down the page, or opening up the calendar widget over your other content by default. This post is first showing how to remove focus from either a input field or the calendar widget, and second showing how easily replicate the Salesforce calendar widget(not a permanent solution as class names and javascript libraries could change at any point in time).

First to remove focus from a normal input field, you can put in a extra input with a type of hidden, and give it a Id. Then write a short bit of javascript to call that hidden field and set focus to it on page load.

see code below

Sunday, June 26, 2011

Visualforce actionStatus Component using the salesforce animated gif

In this post I will show a example of how to use salesforces animated gif and the visualforce actionStatus component to represent a loading screen to the user. This can be very beneficial if you have a tab panel to switch in between tabs, or if you are rerendering a pageBlockTable etc.. This visual stimulation is much more appealing than a blank white screen or just a static screen that is populating asynchronously, which could confuse or frustrate a user into clicking off the screen.


Here is the markup

Monday, May 2, 2011

Keyword Action Chatter Trigger – Keyword in chatter used to update/change records

This is a practice demo for the new chatter triggers, working from the released Spring '11
example. By typing the keyword  '!close'  on a Opportunity entity feed, it will automatically close the Opportunity. This could be a very usefull feature to quickly close an opp from a mobile phone on the mobile chatter app.


Here is the trigger code

Thursday, April 28, 2011

Ajax Collapsible Panel / Modal Popup Flicker on pageload fix

The Modal Popup Extender and the Collapsible Panel Extender sometimes cause the screen to flicker on page load. To solve for this do the following.

Modal Popup
Set the style property display to 'none'


Collapsible Panel Extender
Make sure the extender has SuppressPostBack="True", and on the panel itself set the Height="0px" and a style property overflow:hidden;







Visualforce component basic examples (more to come)

This is a collection of different basic visualforce components for getting started with developing in salesforce. Also a few examples of components that are similar to someone coming from a .NET background into salesforce developing. Hopefully eliminating wasted time searching all over for samples of these different controls.

Live demo available here.


Ajax Modal Popup Extender

Problem/Challenge:
Call on a Modal Popup represented in the Master Page's code behind from a content page in order to display the Magic 8 Ball project I created using the techniques from week 2 fundamentals of C# at Centriq. To do this I originally just re-created the entire project on the Project page. However I did not like having such a large amount of duplicate code.

Solution:
Using the Master Find Control Method allows full use of any control on the master page on all content pages with full functionality.

protected void magic8BallMPE_Click( object sender, EventArgs e) 
{ 
   ModalPopupExtender mpe8Ball = 
          Master .FindControl("mpe8Ball") as ModalPopupExtender;
   mpe8Ball.Show(); 
}


Image button causes validation

Problem/Challenge:
While creating my Contact form page I had several textboxes and a submit button all with various required entry validation assigned to them. This validation intended to prevent the submission of an incomplete form when clicking the submit button. The rest of the Contact page had additional buttons, represented on my master page, and when testing further realized these buttons when clicked from the Contact page, caused validation of the whole page to fire, preventing those buttons action from being executed due to the Contact form being incomplete.

Ajax Collapsible Panel Right Border

Problem/Challenge:
When using the ajax control toolkit, I first added a ajax collapsible panel for my Social Media/Extra tab at the top of my website I noticed an unusal behavior of the panel's 'border-right' not showing up when expanded.

Solution:
To solve this I was able to wrap the collapsible panel in a 'wrapper div' with the border-right property on this instead. I used this solution again on my Theme Switch collapsible panel when it displayed similar behavior with the 'border-right' property not showing up in any browser.

Theme Swap

Problem/Challenge:
For my page theme swap project, I created four different color scheme layouts for the websites overall look and feel, so when the theme button was clicked the corresponding color theme would switch throughout the website. However in order to switch the theme on button click the page required a postback to fire the Page_PreInit method which assigned the selected theme in the session. I wanted the postback to switch the theme but stay on the current page the theme was switched from.