RSS

Apex pageMessage revealed

Hello Guys,

It was always confusing to understand the various tags salesforce provides for showing message in vf page. Those tags are.

<apex:message>, <apex:messages>, <apex:pageMessage>, <apex:pageMessages>

Below post provides Detailed explanation of each of the tag.

http://jessealtman.com/2013/08/difference-between-the-multiple-messaging-options-in-visualforce/

 
1 Comment

Posted by on March 11, 2014 in force.com, salesforce, TechIssues

 

Tags: , , , , , , ,

Curly vs square bracket

Just wasted 2 hours figuring out the issue with ‘apex:inputText’ element.

Did one mistake. instead of curly bracket ( } ), used square bracket ( ] ) and salesforce started giving me misleading error message i.e. ‘Styleclass’ is already specified for the tag inputtext. While the issue was just a bracket 😀

 

<apex:inputText styleclass=”input pull-left” value=”{!PaymentInfo.payAmount}”></apex:inputText>

<apex:inputText styleclass=”input pull-left” value=”{!PaymentInfo.payAmount]”></apex:inputText>

 
Leave a comment

Posted by on November 10, 2013 in Home

 

Tags: , , , , , , , ,

IsVisibleInSelfService = true :)

I was working on assignment which required me to access Tasks and show on customer portal. I written the apex code and fired SOQL, but to my surprise none of Tasks were fetched. I thought its a permission issue from profile or sharing access issue.

However at the end I found that there is a field on task object called IsVisibleInSelfService which derives the visibility of the tasks for customer portals. Even Apex code can’t find the task if this boolean field is not set to true.

Probably its trivial information but usefull when you are not aware of this 🙂

 
4 Comments

Posted by on April 18, 2013 in Home

 

Tags: , , , , , , , , ,

Quote

To utilize the zipped css or JS in visual force page we need to include them first. which requires special syntax.

    <apex:includeScript value="{!URLFOR($Resource.jquery, 'js/jquery-1.3.2.min.js')}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery, 'js/jquery-ui-1.7.2.custom.min.js')}"/>
    <apex:stylesheet value="{!URLFOR($Resource.jquery, 'css/ui-lightness/jquery-ui-1.7.2.custom.css')}"/>

For more information go to following page.

http://www.tehnrd.com/setting-up-jquery-with-salesforce-com/

Using zipped resources in Visualforce page

 
1 Comment

Posted by on July 7, 2012 in force.com, salesforce, TechIssues

 

Tags: , , , , , , ,

generate CSV file in SFDC Apex

To generate CSV file through Apex is fairly simple. Following steps will help you to understand it.

  •  Create a Controller and write a method which returns List of items.
public class generateCSVController{
   public List LeadList{get;set;}
    public generateCSVController(){
             //Populate List here.
              LeadList = [select id,name,email from lead limit 10];
    }
}
  • Create a page and associate it with the controller we created in first step.  Set the content type of the page to “text/csv”.
< apex:page controller="generateCSVController" cache="true"  contentType="text/csv#Leads.csv" language="en-US" >"Id","Names","Email"
< apex:repeat value="{!LeadList}" var="L" >
"{!L.id}","{!L.name}","{!L.email}"
< /apex:repeat >
< /apex:page >
 
Leave a comment

Posted by on June 12, 2012 in salesforce, TechIssues

 

Tags: , , , ,

Play snake game inside Youtube video

Yes. You can play your very own snake game inside any youtube video screen. If you are getting bored you can just follow below trick and start playing the game immediately. This trick works in the Youtube site’s video as well as embedded videos.

Image

1) Click on any youtube video to view.

2) you will see waiting gif, while it is being loaded.

3) At the same time press ‘Down” and “Left” arrow two three times.

4) Eventually the waiting gif will convert into snake. and you can control the snake by arrow keys.

Now try the trick in below video. Just click on play and when it shows the loading GIF press “down” “Left” arrows twice thrice and snake game will apear.

Have a nice play 🙂

 
Leave a comment

Posted by on April 7, 2012 in Home

 

Tags: , , , , , , , ,

Uploading animated images on Facebook

I was wondering by the animated images floating around on facebook. AFAIK, facebook tries to stay simple and clean, To provide nice user experience. It has been one of the success factor for facebook in the social networking. However GIF animated images were floating around so I decided to dig in to get what feature facebook has launched now.


After searching for around 1hour, I got to know that it was a security hole in facebook image compression technique which somebody bypassed and it then started spreading. Following is the way to publish animated images on facebook posts.

Upload a small animated gif (about 50 KB or less)as your profile photo (Facebook will flatten animated gifs which are to large, but do not detect the smaller ones). It will then be in your profile’s album. Your icon itself will NOT be animated. However, you will see it as animated in your Facebook profile photos folder, and by going to that photo, & clicking on “share”, it will appear on your wall as animated.

However above technique has stopped working now, since facebook worked on that small bug. Thank god, It might have become an failure point for facebook otherwise.

While searching this URL was useful for me.

 
1 Comment

Posted by on April 6, 2012 in Home, TechIssues

 

Tags: , , , , , ,

writing test cases for Apex Rest classes

Writing test coverage for Apex classes is the best feature I have seen in salesforce. In this way We ensure that our code is working fine.
However recently in Winter release salesforce provided new way for Apex Rest apis. There is no need to provide req/res parameters to the method. Below Syntax will work perfectly.

@HttpGet
global static String doGet() {
//Do stuff here....
}

But question arise how we will be writing unit tests for the same now. So for you below is the snippet which works perfectly fine. Instead of passing variables, We just need to set the RestContext object and then call the rest method. Thats all. Salesforce will automatically pass the “restContext.req” and you would be able to test your code. Happy coding.

@RestResource(urlMapping='/v.9/member/*/results/*')
global with sharing class MemberRestSvc {

@HttpGet
global static String doGet() {

String[] uriKeys = RestContext.request.requestURI.split(‘/’);
// do awesome programming stuff here
system.debug(‘uriKeys’ + uriKeys);
return ‘awesomeness-happened’;
}

static testmethod void testMemberRestsvc(){

RestRequest req = new RestRequest();
RestResponse res = new RestResponse();

req.requestURI = ‘https://na14.salesforce.com/services/apexrest/v.9/member/me/results/today&#8217;;
req.httpMethod = ‘GET’;
RestContext.request = req;
RestContext.response = res;
String results = MemberRestSvc.doGet();
System.assertEquals(‘awesomeness-happened’,results);

}
}

You can consider this discussion link to have more understanding.

 
 

Tags: , , , , , , ,

Ye saali zindagi

Ye saali zindagi

Just watched Ye saali Jindagi… Nice movie with good script and nicely directed. you don’t get a chance to get bored, It has pace all  the time and lot of twists and turns.

IMDB rating is 7.7 http://www.google.co.in/url?sa=t&source=web&cd=3&sqi=2&ved=0CEEQFjAC&url=http%3A%2F%2Fwww.imdb.com%2Ftitle%2Ftt1754920%2F&ei=rKN0TsPtMI3rrQfw27HAAw&usg=AFQjCNHQV-5ZFn0qfpuwe024aBIzPc2X9Q

 
Leave a comment

Posted by on October 22, 2011 in General

 

Green park restaurant

Just had a lunch in Green Park Restaurant, pune. Its located at Baner Road, Pune. They are having nice taste for Veg. as well as for Non Veg. Service is good as well.

For 7 people it cost around 2500.

 
Leave a comment

Posted by on September 16, 2011 in General

 

Tags: , , ,