Friday, November 28, 2014

SOQL Query Editor as Chrome Extension

I as a developer always need to query Salesforce.com from developer console. However I feel its quite slow.

This tool allows you to query right from your chrome extension and show results beautifully. And best part, you can download results in excel :)

Do try this - https://chrome.google.com/webstore/detail/salesforce-soql-query-edi/fcbnphbbaaommndlpdaldnfejndammcc


Friday, February 15, 2013

Creating Model dialog using Visual force

Below is the example to add a model dialog in you visual force page. This dialog can be rendered conditionally. On displaying this dialog, the rest of the visual force page freezes and user cannot click anywhere else on the page. 

Step 1– Create a model component

<apex:component layout="block">
    <apex:attribute name="id" type="string" required="true" description="The id of the dialog"/>
    <apex:attribute name="visible" type="boolean" description="Whether the dialog is visible or not"/>
    <apex:attribute name="bgcolor" type="string" default="white" description="Background color of the dialog"/>
    <apex:attribute name="border" type="string" default="2" description="Width of the dialog border in px"/>
    <apex:attribute name="width" type="string" default="80%" description="Width of the dialog"/>
    <apex:attribute name="height" type="string" default="80%" description="Height of the dialog"/>
    <apex:attribute name="top" type="string" default="10%" description="Top of the dialog"/>
    <apex:attribute name="left" type="string" default="10%" description="Left of the dialog"/>
    <apex:attribute name="overflow" type="string" default="visible" description="Overflow behaviour i.e. scroll/auto/hidden"/>

    <apex:outputPanel >
        <apex:outputPanel styleClass="{!id}dialogBackground" layout="block" rendered="{!visible}" />
        <apex:outputPanel styleClass="{!id}dialogStyle" layout="block" rendered="{!visible}" >      
            <apex:componentBody />
        </apex:outputPanel>
    </apex:outputPanel>
   
    <style type="text/css">
        .{!id}dialogStyle
        {
            background-color: {!bgcolor};
            border-width: {!border}px;
            border-style: solid;
            z-index: 9999;
            padding:10px;
            position: fixed;
            overflow: {!overflow};
            width: {!width};
            height: {!height};
            left: {!left};
            top: {!top};
        }
        .{!id}dialogBackground
        {
            background-color:black;
            opacity: 0.20;
            filter: alpha(opacity = 20);
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            z-index: 9998;
        }
    </style>
</apex:component> 


Step 2– Add this component in Visual force page where you want to add a model dialog.

<c:ModalDialog id="myModelDialog" visible="{!displayModelDialog}" border="5" width="80%" height="80%" overflow="auto" left="10%" top="10%">
         <!-- Here you can add body of the model dialog -->
         <h1> This is your model dialog <h1>

</c:ModalDialog>

Wednesday, February 13, 2013

Visualforce popup scrollbar issue for Mozilla

Did you ever try to open up popup window from visualforce using javascript? Something like

window.open('/apex/ContactDetail?id=' + conId,'','location=no,resizable=no,toolbar=no,status=no,menubar=no');

The above code works for all browsers other than new versions of Mozilla Firefox. You need to add extra tag in the method -

"scrollbars=yes"

So the method will be -

window.open('/apex/ContactDetail?id=' + conId,'','location=no,resizable=no,toolbar=no,status=no,menubar=no,scrollbars=yes');

Date Picker in Visual force

Below is the example to add to a Date Picker on <apex:inputText> for the Date/ String fields in visual force:

<apex:inputText label="Start Date" value="{!dateVariable}" onfocus="DatePicker.pickDate(false, this, false);"/>

Here 'dateVariable' is a variable being referred from controller.

Tuesday, February 12, 2013

Salesforce.com known issues

The new Salesforce.com release has a bunch of knowns issues which can be tracked here -

http://success.salesforce.com/issues_index

Thursday, October 25, 2012

Enhanced list views on a Visualforce page

Enhanced lists are used when you want to display a specific list view for a standard or custom object, rather than having all list views available for the user to select.
Step 1 – Create the list view
Go to the standard or custom object and click on the Create New View next to the Go button. Create the view and click on Save. When the page has reloaded, you will notice in the url a 15 digit id has been created for your view. Copy or make a note of the id.
 
 
 
 
 
 
 
 
 
 
Step 2 – Add code to your visualforce page
Add the following bit of code to your visualforce page, replacing the listid with your id:
<apex:enhancedlist type=”Lead” height=”730″ customizable=”false” rowsPerPage=”25″ Listid=”00B30000007wesH” />
Change customizable to equal true if you want your users to be able to edit the filters on the view. Once saved, you should find your visualforce page displays an enhanced list similar in appearance to the image below.

Change Password using apex code

setPasswordID userID
String password
VoidSets the password for the specified user. When the user logs in with this password, they are not prompted to create a new password. Use resetPassword if you want the user to go through the reset process and create their own password.
Warning
Be careful with this method, and do not expose this functionality to end-users.

e.g. System.setPassword('006A123ahjklkk','password123');