Be Good & Do Good!

Tag: Salesforce (Page 10 of 11)

Apex Handy Code to fetch hostname, relativeURL, absoluteURL

Relative path for your Visualforce page: ApexPages.currentPage().getUrl();
Hostname of your salesforce org: ApexPages.currentPage().getHeaders().get(‘Host’);

The complete code for constructing the absolute path for a Visualforce page is below:
String hostname = ApexPages.currentPage().getHeaders().get(‘Host’);
String pageUrl = ApexPages.currentPage().getUrl();
String absolutePath = ‘https://’ + hostname + pageUrl;

Ack : Jesse Lorenz

Salesforce CRM – The Service Cloud

The Service Cloud is the new platform for customer service. You can tap into the power of customer conversations no matter where they take place. Harness know-how from the right experts, whether they’re on a Web community forum or having a dialog on Facebook. Suddenly, you’re part of those conversations. And thanks to new Salesforce for Twitter integration, you can now tap into one of the fastest-growing communities for conversations in the cloud.



Salesforce – Apex Search with Checkbox Results

Following demo is a single Apex custom controller, two Visualforce pages and a wrapper class allowing the user to search an object by keyword (via Dynamic SOQL) and return the results in a page block table with corresponding checkboxes. Selecting one or more checkboxes and clicking the ‘See Results’ button displays the list of the selected items.

This is a very common function as you typically want to search for stuff and then process some selected stuff.

You can run this demo on Jouff Douglas developer site.

cat-screenshot

View Complete Code @ Jouff Douglas

Salesforce – Visualforce Component to show Object Record Types

Show Object Record Type

In this article Sam presents us a Visualforce Component that would list the record types of an Object in the platform.

Now following are words from Sam …
Imagine, the Account object has two record types in the force.com platform (Record Types are created by the users based on what these objects represent on their business).

Account Record types:

  • Customer
  • Partner
In many occasions especially when developing a new wizard you need to first allow the user select what type of record they want to create and then based on that show the correct type of interface to the user.

The solution as to how you can show this to the user is rather simple, but here I actually took the time to create a re-usable component, so you and I won’t need to rewrite the code next time!

View Component and Component’s Controller Code @ http://salesforcesource.blogspot.com/2009/01/visualforce-component-to-show-object.html

Salesforce – Access Public Knowledge Base of any Salesforce Org – Bug or What ?

Following is a bit tricky code what i discovered, may be its already known to few of us ..

Following is the url to access Public Knowlede Base of any Salesforce Org, just change the org id.
http://na1.salesforce.com/sol/public/solutionbrowser.jsp?search=donkey&cid=000000000000000&orgId=00D30000000XXXX

Only Assumptions above is that
* Org to have Knowledge Base to be Enabled
* A Solution named donkey to be defined already in Org

Does Public Knowledge Base means its public to everyone in this world who uses Salesforce Org. Isnt it should be public to only users or persons relevant to that Org. Addition of any unique identifier apart form Org id to increase Validation of Invoker.

My understanding of this may be completely wrong, just correct me if am wrong.Just saw something suspicious and felt to update salesforce developers, so came up with this post !!

Blogged @ http://community.salesforce.com/sforce/board/message?board.id=discuss&message.id=8291#M8291

Salesforce – Force.com Email Services(Email To Apex)

Force.com Email Services or “email to Apex” lets you define email addresses, which can process Apex code. Send emails to Salesforce and process them with Apex code to create and update data from inbound emails.

Following sample code @ Apex Wiki shows you how an email can be used to create new tasks for a contact record with a matching email address i.e., Send an email to Salesforce with a follow-up note, will setup a task with a reminder 1 day for now.

Retrieved from “http://wiki.apexdevnet.com/index.php/Force.com_Email_Services

Salesforce – Spring ‘09 Features Released

Ack:- Sam Arjmandi

  1. Force.com Sites Improvements

    • Audit Trail:
      Now you can track all the changes made to your sites by different users.
    • Sites Robot.txt and Fav Icon:
      With this release you will be able to set a robot.txt for you force.com site which enables you to better control how search engines should index your site’s pages. Fav Icon is also a useful way of personalizing the browser in showing an icon next to the title of your website (in tabs) and also in favorites/bookmarks.
    • Standard Pages:
      Allows you to bring selected standard pages and expose them to the public via your force.com site (suitable for ideas page, etc).
    • Sites Packaging:
      With this feature we can package force.com sites, apex code, etc and install them into other instances.
  2. Force.com Web Service API Improvements

    • Improvements in the timeout limits of the callouts:
      This is potentially good when the code takes a longer time to process and bring back the results. Now we can configure it in a way to have extended timeout periods resulting in more run-time stability.
    • Also Wider range of WSDL types are supported by Spring 09 release.
  3. Database and Reporting

    • Summary Report Data Snapshots:
      Previously data snapshots were available on reports, however, with this release you can use snapshots across large amounts of data, where only the summaries will be stored, as well as create historical views of metrics, KPIs and other summary data.
    • Data Grouping Functions:
      This is actually a very useful upgrade, now you can group the entries of a report to better analyze aggregate data.
    • Delegated Data Administration:
      This feature allows you to grant permission to non-admin users to report, search, modify, transfer, share, unlock, or approve any record regardless of sharing settings on an object basis.
    • Dashboard Finder:
      This enhancement allows you to search through your dashboard items (a real time-saver!).
  4. Force.com IDE

    • Apex Code Auto-Complete in Force.com IDE:
      Finally! When you are coding in Eclipse (force.com IDE) auto-complete feature will be available to assist you with writing the code.
  5. User Interface

    • Enhanced Page Layout Editor:
      This one is my favorite enhancement, using this feature now you can create much better layouts. You can drag and drop fields and items around, “save as” a layout, leave a spot empty (blank spaces), design the mini-layout, etc.
  6. Services

    • Cross-Object Workflow:
      With this feature you can update a field on a parent record within a workflow!
    • Access to Email Logs in the Application:
      This report shows you whether your outbound emails were received or bounced back and basically gives you a comprehensive log of your outbound emails.

  7. Force.com Logic


  8. Mobile

    • Mobile Web Tabs for iPhone
      You can now create mobile-ready Visualforce Tabs for the iPhone. This enhances the client with a near-limitless method of extension – enabling you create content for the iPhone using the Visualforce user interface framework. The hybrid iPhone client that supports this functionality will be released next month.

Salesforce – Use Visualforce and Apex to Populate PDF Forms

Source : Salesforce Blog


Jesse Lorenz blogs following about how to use Visualforce and Apex to Populate PDF Forms

Does your company’s business process involve filling out PDF forms? Perhaps something like IRS Form W-4?

If so, you may be interested to learn that in addition to creating PDF documents from scratch, you can also use Visualforce and Apex to automate the process of populating third-party PDF forms. Ron Hess and I(Jesse Lorenz) recently collaborated on a project that does just that. It’s a straightforward process where all you really need to do is generate an XML file that follows Adobe’s XFDF format.

If you’re interested to learn more, we’ve documented an example that creates an XFDF file which is then used to populate a simple PDF form. Read the XFDF wiki article to learn more.

Salesforce – Displaying the Required Red Bar for a Control

Many a times Visualforce page uses a number of outputLabels and selectLists to create the functionality below.

Red Bar

<apex:pageBlockSectionItem >
    <apex outputLabel value=”Category 1″ for=”cbxlevel1″/>
    <apex outputPanel styleClass=”requiredInput” layout=”block”>
    <apex outputPanel styleClass=”requiredBlock” layout=”block”/>

    <apex:selectList value=”{!selectedLevel1}” id=”cbxlevel1″ size=”1″ required=”true”>
        <apex:selectOptions value=”{!level1items}”/>
        <apex:actionSupport event=”onchange” rerender=”cbxlevel2″/>
    </apex:selectList>
    </apex outputPanel>

</apex:pageBlockSectionItem>

Setting the selectList’s required attribute makes the select’s value required but does not, by design, display the red bar next to the label. This is perfect is it does not lock developers into Salesforce.com’s look and feel. However, to actually display the required red bar, you have to add some extra code

Ack:- Jeff Douglas

Help Bubble (Hover Based Tooltip) – Visualforce

helpText : The help text that is displayed next to this field as a hover-based tooltip, similar to the text that is displayed next to standard Salesforce fields if custom help is defined for the field in Setup.

Important thing to have a help bubble near to any of form fields is to use helptext
within <apex:pageblocksectionitem>

Note : Few Closing Tags may be missing due to HTML Code Conversion.

Ack : Visualforce Blogspot

« Older posts Newer posts »