Osama's Weblog

The place where you get updated!
  • rss
  • Home
  • Who am I?
  • RSS Feeds

Visualforce enhancements

Osama | June 26, 2010

I was studying the latest pages developers guide and found some components that have been added to salesforce.com.

These are

  • Apex Panel Bar
  • Apex Panel Grid
  • Apex Tab Panel

These controls can further enrich the user experience and the developer can now avoid to use external library components such as jQuery etc in visualforce.

I have created a simple demo which can show these working. Its almost same as in the guide.

  • Share/Bookmark
Comments
No Comments »
Categories
APEX, VisualForce, salesforce
Tags
APEX, paelbar, panelgrid, salesforce, tabpanel, VisualForce
Comments rss Comments rss
Trackback Trackback

Apex InputField on Force.com site (contd..)

Osama | March 10, 2010

Few days ago I wrote a blog post in which I mentioned that I wasn’t able to access apex:input field on a force.com site. With the help of a my blog reader, I figured out what was the problem. Its pretty straight forward.

You cannot give extra permissions to standard objects on a force.com site. But  you can give Modify All Data and View All Data permissions to a custom object . That means you can use apex:inputField on a force.com site which is bound to a custom object field. Make sure about field level security.

Thanks to Jason.

  • Share/Bookmark
Comments
2 Comments »
Categories
APEX, VisualForce, salesforce
Tags
APEX, force.com, inputField
Comments rss Comments rss
Trackback Trackback

JQueryUI Datepicker in a Visualforce page

Osama | March 4, 2010

JQuery has always fascinates me. It makes the UI very attractive and user friendly. I had to implement a datepicker in a text field. I decided to use the JQuery UI datepicker. I am sharing the code that I did. Its easy to understand.

I made a static resource with the name slider and uploaded all the css and js files of JQuery UI that are available for download here .

1) Include the css files in your page

<link type="text/css" href="{!URLFOR($Resource.Slider, 'themes/ui-lightness/ui.all.css')}" rel="stylesheet" />
<script type="text/javascript" src="{!URLFOR($Resource.Slider, 'jquery-1.3.2.js')}"></script>
 <script type="text/javascript" src="{!URLFOR($Resource.Slider, 'ui/ui.core.js')}"></script>
 <script type="text/javascript" src="{!URLFOR($Resource.Slider, 'ui/ui.datepicker.js')}"></script>

2) Make a input text field and create the following JQuery function as below

 <input id="datepicker" type="textbox" />
<script type="text/javascript">
    $(function() {
        $("#datepicker").datepicker({ showOn: 'button', buttonImageOnly: true, buttonImage: '{!$Resource.calendar}' });
    });
    </script>;;

3)   $(“#datepicker”).datepicker({ showOn: ‘button’, buttonImageOnly: true, buttonImage: ‘{!$Resource.calendar}’ });
The datepicker pops up when you click on the image button that is created using the above statement. If  you want to pop it up by clicking the textbox only, replace the above statement with the below one:

  $(“#datepicker”).datepicker();

I hope it helps for you as it did for me. Feel free to ask questions

  • Share/Bookmark
Comments
11 Comments »
Categories
APEX, General, VisualForce, salesforce
Tags
APEX, datepicker, jquery, VisualForce
Comments rss Comments rss
Trackback Trackback

Apex InputField on Force.com Site

Osama | February 17, 2010

I came across a strange situation today when I was trying to use a apex:inputField tag and call it on a visualforce page through force.com site. But the field wasn’t visible when seen on public force.com site.

This is what I did

 public class testClass
          {
               public Account acc {get; set;}
          }

and here is the visualforce page

<apex:page   controller=”testClass”>
<apex:inputfield value=”{!acc.Name}”/>
</apex:page>

I also changed the permissions in Force.com guest user profile. But still I wasn’t able to make the field visible. I think its a limitation from security point of view.

If someone else has experienced the same thing or has any recommendations, do let me know.

  • Share/Bookmark
Comments
1 Comment »
Categories
APEX, VisualForce, salesforce
Tags
APEX, force.com, inputField
Comments rss Comments rss
Trackback Trackback

Placing a visualforce page on sidebar

Osama | January 26, 2010

Placing a visualforce page on sidebar is really simple.

1) Create a visualforce page.

2) Create a custom  HTML homepage component. Place the following code in the HTML area.

<iframe src="/apex/[PAGE NAME]?core.apexpages.devmode.url=1" width="100%" frameborder="0" height="100"></iframe>

replace [PAGE NAME] your custom page name.

3)Place it on the left side of home page layout.

and here u go…

  • Share/Bookmark
Comments
No Comments »
Categories
APEX, VisualForce, salesforce
Tags
salesforce, sidebar, VisualForce
Comments rss Comments rss
Trackback Trackback

“An error occurred on your page” issue

Osama | January 22, 2010

I was deploying an apex class through Force.com IDE on a production environment. It was continuously giving me an error “An error occurred on your page”. I wasnt getting the message but on some googling I came to know that my class was using many pageReference methods which were returning some page. The problem was pages include the class as their controller and the in the class pages were being called. The deployment method is sequential on force.com IDE which was creating problem.

The pages were not deployed on the production environment and that is why it was giving me the error. I found a solution somehow. What I did was, removed the ‘return page.myPage’ from the class and include ‘return null’. The class was deployed. Then I deployed the pages. After the pages got deployed, I edited the class, replaced the ‘return null’ statement wirh “return page.MyPage”. This requires lot of rework but solved my problem.

  • Share/Bookmark
Comments
No Comments »
Categories
APEX, General, VisualForce, salesforce
Tags
An error occurred on your page, force.com, IDE
Comments rss Comments rss
Trackback Trackback

Encrypted Fields in salesforce.com

Osama | January 20, 2010

Salesforce.com offers encrypted fields to use in standard and objects. Encrypted fields are available by request only.

Encrypted field allows users to enter any combination of letters and numbers and store them in encrypted form.

These fields are used to store private data like passwords and credit card information. There are certain consideration for encrypted fields:

  • You cannot implement workflows on encrypted fields.
  • Encrypted fields are accessible through apex. That means if you are accessing an encrypted field in apex, it will show un-masked data and not the masked one.
  • You can set a maximum length of up to 191 characters.

Salesforce.com offers following masks for encrypted fields:

  • Mask all characters
  • Last four characters clear
  • Credit Card Numbers
  • National Insurance Number
  • Social Security Number
  • Social Insurance Number

Moreover, we can have two kinds of mask characters, ‘X’ and ‘*”.

  • Share/Bookmark
Comments
No Comments »
Categories
APEX, General, VisualForce, salesforce
Comments rss Comments rss
Trackback Trackback

Rich Text Mode in Salesforce Spring’10 Release

Osama | January 13, 2010

Ever implemented an image uploading related to a record? You must have uploaded to documents first and then called it in a formula field. But you don’t have to get into this mess now. Because Salesforce is releasing Rich Text Mode in its Spring’10 release.

The new rich text mode will be the data type in the for a field which will allow you to add up to 32kB of data in it. You can format your text in it as well as upload an image in it.  By format, I mean you can make the characters bold, italic, numbering etc. Its a great feature!

Here is what salesforce says about this

  • Richly format your data by bolding, italicizing, underlining text or by   adding bulleted or numbered lists
  • Easily link to data on the internet with hyperlinks
  • Display multimedia content such as images

Below are the images which demonstrates this feature.

Untitled Untitled1

In the first image, the highlighted one is the data type at the time of field selection and in the second image Descriptions is the field whose data type is Rich Text Mode.

Isnt it great???

  • Share/Bookmark
Comments
No Comments »
Categories
APEX, General, VisualForce, salesforce
Tags
customization, rich text, salesforce
Comments rss Comments rss
Trackback Trackback

Multilevel-Master Detail Relationships

Osama | January 12, 2010

Salesforce is growing faster. They are there to satisfy there customers and developers. Salesforce, in its Spring’10 release, is introducing Multilevel-Master Detail Relationships. This is an idea which was discussed in salesforce ideas community.

With multi-level relationship you can:

• Create complex data models with linked master-detail relationships
• Create reports with data from all levels of your complex data model
• Perform cascading deletes when the master record is deleted—removing the need to delete “orphaned” subdetail records
• Include line-item records that reside in the subdetail objects in roll-up mathematical calculations
• Define custom report types that use data across the multilevel master-detail relationship

The relationship under discussion will create a sub-detail relationship with the detail object.

Master –> Detail –> Sub-detail

Suppose I have an object Account, its detail object Order and a sub-detail object called Order Line items. They are related this way:

Account –> Order –> Order Line

In previous versions, the detail object couldnt be a master for anyother object. But after this release, we can say that the detail object could be a master for sub-detail object. But still, the detail or sub-detail object can not be a master of any other master-detail relationship.

There are certain considerations for this kind of relationship as follows:

• When a master record is deleted, the related detail and subdetail records are also deleted. This means when an account is deleted, its related orders and order line items will also be deleted. This also means if an order is deleted, its order line items will be deleted.
• The Owner field on the detail and subdetail records is not available and is automatically set to the owner of the master record. Custom objects on the “detail” side of a master-detail relationship cannot have sharing rules, manual sharing, or queues, as these require the Owner field.
• The security settings for the master record control the detail and subdetail records.
• The master-detail relationship field (which is the field linking the objects) is required on the page layout of the detail and subdetail records.
• The master object can be a standard object, such as Account or Opportunity, or a custom object.

• Upto three custom detail levels are allowed.

• Standard objects cannot be on the detail side of a custom object in a master-detail relationship, because they have owner field.

• You cannot create a master-detail relationship if the custom object already contains data. You can, however, create the relationship as a lookup and then convert it to master-detail if the lookup field in all records contains a value.

•Roll-up summary fields work as in two-object master-detail relationships. A master can roll up fields on detail records;however, it cannot directly roll up fields on subdetail records.To achieve this, the detail record must have a roll-up summary field for the field on the subdetail record, allowing the master to roll up from the detail’s roll-up summary field.

•You cannot delete a custom object if it is on the master side of a master-detail relationship.

• Undeleting the master record also undeletes detail and subdetail records.

These  are just a few considerations. Rest of them can be found in spring ‘ 10 release notes. I am just wondering how simple would business processes be after this functionality.  Salesforce is also introducing Quote as a standard object and there is a Quote Line Item object as its Detail I guess. Making another sub-detail object with Line item will improve the business process.

My client purchased an application from AppExchange to achieve this thing. But I wish if could have waited a little. This is freaking awesome. Wow!!

Feel free to ask questions.

  • Share/Bookmark
Comments
No Comments »
Categories
APEX, General, VisualForce, salesforce
Tags
master-detail, multilevel, salesforce
Comments rss Comments rss
Trackback Trackback

Invoke APEX code from custom button

Osama | January 11, 2010

There is a really good example of invoking apex code through apex code here. But I have found another way to invoke the apex method without using visualforce pages.

This is how I did:

1) Suppose you want to place a button on the Account detail  page to call apex method. Clone the Account detail page by creating a new visualforce page.
<apex:page standardController=”Account” extensions=”newCOn” >
<apex:form >

<apex:commandButton value=”Convert” action=”{!getID}” ></apex:commandButton>
<apex:detail relatedList=”true” relatedListHover=”true” />
</apex:form>
</apex:page>
2) Create the method getID() in the extension class that has been defined above.
public class newCon()
{
public void getID()
{
//make your custom logic here
}
}
3) Override this page on VIEW page under Setup>Customize>Accounts.

And in this way you have called an apex method without redirecting it to another visualforce page.

Feel free to ask questions.

  • Share/Bookmark
Comments
No Comments »
Categories
APEX, VisualForce, salesforce
Tags
APEX, button, custom, VisualForce
Comments rss Comments rss
Trackback Trackback

« Previous Entries

My status

Categories

  • .NET
  • APEX
  • consulting
  • General
  • Oracle CRM on Demand
  • salesforce
  • Uncategorized
  • VisualForce

MM Did You Know?

MM Did You Know? Wordpress plugin by Milan Milosevic. More...
Plugin by mmilan

Its all about cloud

Salesforce

.NET .NET 4.0 beta actionFunction actionSupport administrator android APEX Apex variable API button certification cloud computing consulting controller custom DoDirectPayment force.com GET goggles google html images input inputField JavaScript jquery master-detail matcher Parallel Programming parameters pattern paypal query string REGEX regular expression salesforce search url variable Visual Force VisualForce Visual Studio vmware web service XML PARSING DOM SAX STAX

WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.

My Tweets

Error: Please make sure the Twitter account is public.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox