Showing posts with label apex. Show all posts
Showing posts with label apex. Show all posts

Salesforce Context Menu for list views

Tuesday, May 20, 2014 by Aslam - The Alexendra
Hi All,
This is a quick demo for a utility component. I designed it for standard salesforce list views. Its a kind of context menu which can be opened on clicking of a IMAGE formula field. You can show your useful menu options in this context menu. Each option can have the record id automatically by JS, so that your target page or screen can have proper processing based on passed record id.


How to configure:
  1. Make a IMAGE formula field as given in screeshot above
  2. Upload the menu-resources.zip file available on this url
     http://www.aslambari.com/downloads/menu-resources.zip
  3. Make one home page component (HTML type and Narrow side)
  4. Put below code in that component
<!-- include files --> <script src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/jquery.min.js"></script> <link rel="stylesheet" href="/resource/1400648652000/dupedetector__menu_resources/menu-resources/menu.css"> <!-- HTML Menu --> <div class="dropdown-menu" id="dropdown-menu"> <a href="/003?rlid=RelatedContactList&amp;id=" target="_BLANK"> <img src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/application_view_detail.png" /> Sync Contacts </a> <a href="/006?rlid=RelatedOpportunityList&amp;id=" target="_BLANK"> <img src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/calendar-disabled.png"> Export Orders</a> <a href="/005?rlid=RelatedCaseList&amp;id=" target="_BLANK"> <img src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/zip.png"/> View Cases </a> <div class="break"></div> <a href="/_ui/core/chatter/ui/ChatterPage" target="_BLANK"> <img src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/connect_light_small_short.gif"/> Sync Feeds</a> <a href="00T?rlid=RelatedActivityList&amp;id=" target="_BLANK"> <img src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/phone.png"/> Calls History </a> <a href="/002?parent_id=001900000054UZ7&amp;id=" target="_BLANK"> <img src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/3668432.png"/> Box.Net Documents </a> <a href="00T?rlid=RelatedActivityList&amp;id=" target="_BLANK"> <img src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/feature_gmail_icon.gif"/> Google Mails </a> <div class="break"></div> <a href="00T?rlid=RelatedActivityList&amp;id=" target="_BLANK"> <img src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/delete.png"/> Delete Logs </a> </div> <!-- JS Part --> <script> function init_sfdc_menu(){ $('.x-grid3-col-00N9000000A4pIp').click(function(event){ event.stopPropagation(); var id = $(this).attr("id").split("_")[0]; $('.dropdown-menu').css( {position:"absolute", top:event.pageY-100, left: event.pageX-30}); $('.dropdown-menu').find('a').each(function(){ var oldhref = $(this).attr("href"); oldhref = oldhref.substring(0,oldhref.lastIndexOf('=')+1); $(this).attr("href", oldhref + id); }); $('.dropdown-menu').show(); }); $(document).click(function(){ $('.dropdown-menu').hide(); }); } $(document).ready(function(e) { $('#bodyCell').bind('DOMNodeInserted DOMNodeRemoved', function(event) { setTimeout(init_sfdc_menu(),500); }); }); </script>

Changes:
I have designed this component for just showing how to use this utility, so i have not make it very robust or optimize and have left few hard coded ids few places, but any developer who needs to make it work proper, needs to do following changes in files:
  •    Open the menu.css and change hard coded id "00N9000000A4pIp" to your image formula field id on list view
  •    Change the same id available on component code
  •    Once you uploaded your static resource, you will get one timestamp for that which you can see in my component code few places, you need to change it with yours as well and make sure you provide proper url, for example my url for jquery.js is this:
   "/resource/1400648652000/dupedetector__menu_resources/menu-resources/jquery.min.js"
   You need to change this url with yours.
  
Here is a screencast you can see how it works.


Email if for any issue, happy coding :)


Thanks
Aslam Bari
http://www.aslambari.com

Salesforce Remoting & jQuery Drag/Drop Mash-up

Wednesday, February 27, 2013 by Aslam - The Alexendra
Hi All,
Today I am going to show you a good useful mash-up using jQuery Drag/Drop feature with Salesforce Remoting. I have created a simple application where user can see a Dashboard where all Un-Assigned tasks are shown on left side. All available contacts will be available on right side.
Now, user can drag any task from left side list and drop on right side, for any contact. Internally the Task will be assigned to that particular Contact. This is done internally using Salesforce Remoting.
This type of applications are very convenient to use and do the work smoothly.



You can test the application here.
http://labsprojects-developer-edition.ap1.force.com/TaskAssignmentDashboard

Here are few assumptions/points regarding above demo;

1) I have used Contacts to assign the Task but actually we must use Users
2) I have given demo for Tasks, but we can use this application for other useful things like Cases, Leads and Opportunity assignments
3) The demo actually will not update the records in database. I have commented actual database update because of demo purpose. You can only check the drag and drop and assignments.

Mail me if you need the code for above demo.

Your suggestions to improve this app , are always appreciated.

Thanks
Aslam Bari

Simple jQuery Dependent Picklist

Friday, January 18, 2013 by Aslam - The Alexendra

Hi All,
Today I am going to show you how to make dependent picklist on visualforce page with some few lines of code. This is client side dependent list. So it has following benefits:

1) No Action Function or Ajax, means we dont need to call server side script to filter the list of records.
2) Its based on javascript so its fast
3) We can extend the level of dependency



The idea here to use jQuery and one small method to make the dependency. I have got this idea from here.
1) First make your parent select list as below

<select id="accountList" size="1"> <option value="">-Select-</option> <apex:repeat value="{!accounts}" var="acc"> <option value="{!acc.Id}">{!acc.Name}</option> </apex:repeat> </select>
2) Make your child select list. Make sure to give option a class name like this "child_{parent_record_value}".


<select id="contactList" size="1"> <apex:repeat value="{!contacts}" var="con"> <option class="child_{!con.accountid}" value="{!con.Id}">{!con.Name}</option> </apex:repeat> </select>
3) Put the below code in your head section

function prepareList(parent,child,isSubselectOptional){ $("body").append("<select style='display:none' id='"+parent+child+"'></select>"); $('#'+parent+child).html($("#"+child+" option")); $('#'+child).html("<option> — </option>"); $('#'+parent).change(function(){ var parentValue = $('#'+parent).attr('value'); $('#'+child).html($("#"+parent+child+" .child_"+parentValue).clone()); if(isSubselectOptional) $('#'+child).prepend("<option> — Select — </option>"); }); }
4) Call the below method on load of the page. Make sure to pass proper parent and child select list ids.
$(function() { prepareList('accountList','contactList', false); });

Thats it. Now you can see on the page the dependency is created automatically.

You can download the code from here

You can see the working demo here
http://labsprojects-developer-edition.ap1.force.com/DependentPicklist


Thanks
Aslam Bari

TechShare Cloud Forum Launched

Tuesday, March 13, 2012 by Aslam - The Alexendra
Hi All,
I am pleased to inform that I have created a very nice and simple forum where you can post your questions regarding Salesforce and other technology.



Please post your questions there to get answers quickly.

forum.aslambari.com


Thanks
Aslam Bari

Light Weight SF force.com chat plugin for sites

Tuesday, February 14, 2012 by Aslam - The Alexendra
Hi All,
Here, I am going to introduce the "Light Weight SF force.com chat plugin for sites".

This is easy to install and setup in your force.com site and easy to use. The positive thing is that it saves data in your native salesforce object for your review. This is just a demo app, if one want, he can extend this app to make more robust.



1) You can simply install it from here:
https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Q0Re

2) After deploy, you can simply access the first page by /apex/JoinChat It will ask you to click on join now link, if you already logged in before in chat room, you will be redirect to chathome page

3) If you not logged in, you will be redirected to /apex/chatlogin page, here you can give a name for yourself to use in chat room

4) To go chat room, you can call this page /apex/chathome Here you can see existing public people who are logged into same chat room To best use , you need to setup all 3 pages on public force.com site.

Here is a demo hosted on my site:
i)JoinChat
http://labsprojects-developer-edition.ap1.force.com/JoinChat

ii) ChatLogin
http://labsprojects-developer-edition.ap1.force.com/chatlogin

iii) ChatHome
http://labsprojects-developer-edition.ap1.force.com/chathome

Note: For automatic updates, due to too much request i have set 30 seconds auto update for chat

There are chances of more enhancements, but its just a start :)

Thanks
Aslam Bari

Stripe Apex Toolkit

Thursday, October 6, 2011 by Aslam - The Alexendra
Hi All,
Today I came to know about 'Stripe' APIs. Stripe is a simple, developer-friendly way to accept payments online. According to Stripe :-
"We believe that enabling transactions on the web is a problem rooted in code, not finance, and we want to help put more websites in business.
Complexity and opacity have traditionally been hallmarks of online payment processing. We want to fix that."


So, as usual, here I came up with the solution of Apex Wrapper for Stripe APIs. I developed this API library with my colleague Sanjay. The library gives basic api methods to call and use as follows:

//1) CreateCharge
Stripe request = new Stripe('y001LvDyqiGbNZclaaaxxxxttttOJk8w');
StripeResponseModel response
= request.createCharge('4242424242424242', '2013', '10', '123', '2000', 'usd', 'testing');
if(!response.isError){
system.debug(
'Transaction ID :: ' + response.id);
system.debug(
'Transaction Fee :: ' + response.fee);
}
else{
system.debug(
'Error Message :: ' + response.errorResponse.message);
}

//Create charge using customer
Stripe request = new Stripe('y001LvDyqiGbNZclaaaxxxxttttOJk8w');
StripeResponseModel response
= request.createCharge('cus_EPTWuvf7EXDb4g', '2000', 'usd', 'testing');
if(!response.isError){
system.debug(
'Transaction ID :: ' + response.id);
system.debug(
'Transaction Fee :: ' + response.fee);
}
else{
system.debug(
'Error Message :: ' + response.errorResponse.message);
}

//2) CreateCustomer
Stripe request = new Stripe('y001LvDyqiGbNZclaaaxxxxttttOJk8w');
StripeResponseModel response
= request.createCustomer('4242424242424242', '10','2013', '123', 'Aslam', '', '', '', '', 'IN', 'aslam.bari@gmail.com', 'test');
if(!response.isError){
system.debug(
'Customer ID :: ' + response.id);
}
else{
system.debug(
'Error Message :: ' + response.errorResponse.message);
}

//3) RetrieveCustomer
Stripe request = new Stripe('y001LvDyqiGbNZclaaaxxxxttttOJk8w');
StripeResponseModel response
= request.retrieveCustomer('cus_EPTWuvf7EXDb4g');
if(!response.isError){
system.debug(
'Customer Country :: ' + response.card.country);
system.debug(
'Customer Last4 CC :: ' + response.card.last4);
}
else{
system.debug(
'Error Message :: ' + response.errorResponse.message);
}

//4) CreateInvoice
Stripe request = new Stripe('y001LvDyqiGbNZclaaaxxxxttttOJk8w');
StripeResponseModel response
= request.createInvoice('cus_EPTWuvf7EXDb4g', '2000', 'usd', 'test');
if(!response.isError){
system.debug(
'Invoice Id :: ' + response.id);
}
else{
system.debug(
'Error Message :: ' + response.errorResponse.message);
}

//5) RetrieveInvoice
Stripe request = new Stripe('y001LvDyqiGbNZclaaaxxxxttttOJk8w');
StripeResponseModel response
= request.retreiveInvoice('ii_W19Xp6cxrqVABH');
if(!response.isError){
system.debug(
'Invoice Date :: ' + response.created);
}
else{
system.debug(
'Error Message :: ' + response.errorResponse.message);
}

//6) CreatePlan
Stripe request = new Stripe('y001LvDyqiGbNZclaaaxxxxttttOJk8w');
StripeResponseModel response
= request.createPlan('AMX_101', '2000', 'usd', 'month' , 'AMX Testing');
if(!response.isError){
system.debug(
'Plan Id :: ' + response.id);
}
else{
system.debug(
'Error Message :: ' + response.errorResponse.message);
}

//7) RetreivePlan
Stripe request = new Stripe('y001LvDyqiGbNZclaaaxxxxttttOJk8w');
StripeResponseModel response
= request.retrievePlan('AMX_101');
if(!response.isError){
system.debug(
'Plan Label :: ' + response.name);
}
else{
system.debug(
'Error Message :: ' + response.errorResponse.message);
}


You can download the code from github here:
https://github.com/aslambari/Stripe-Apex-Toolkit

Or from my website here:
http://www.aslambari.com/stripe_apex_toolkit.html

There are many more methods which are under development like CreateSubscription, ListAllCustomers etc, we are working on them. And will back soon with full set of methods. Till, try this library and let us know if that works fine for you and revert back us for enhancements.

Thanks
Aslam Bari

SF Uploadify: File Uploading Utility for Salesforce

Tuesday, September 13, 2011 by Aslam - The Alexendra
Hi All,
I have created a very cool file uploading utility which can be integrated with any system, but mainly I focused on Salesforce. This utility is built using Uploadify Tool and PHP integration. You can find more info about Uploadify here. It supports multiple file uploading with progress bar and uploads the file to your external server (php server where your site or this utility is hosted.) Then it makes the Attachment record in salesforce and links to actual file on server. So you can directly (natively) access your files.


How it works:

  1. User opens any record in salesforce , lets say "Account" record.
  2. There will be a custom button (given in below code), user clicks on button
  3. One file uploading screen opens, click on 'Select Files" button and select multiple files at same time (using control button)
  4. As soon as, user select and close dialog, it starts uploading files with progress bar
  5. The files will be stored on the Server where this utility exists, for now it saves to my server.
  6. It will show finally a screen with close button.
  7. Click on close button , it will refresh the parent window (if not, manually refresh the parent record)
  8. Open the attachments section, you will find the new files (attachments created, which actually a link for actual files on the server)
  9. Click on any file and click on "View" link.
  10. And you will see it opens your uploaded actual file :)

More Details and Updates on my site:
http://www.aslambari.com/sf_uploadify.html

Installation:
1) Button code:
Make one custom button (detail screen button), on any object, for example , account object, see below code.
a. Behavior must be "Open in new window"
b. Content Source will be "URL"
The url for the button will be as below

http://labs.aslambari.com/sf_file_uploader/sf_setup_uploader.php?sessionid={!$Api.Session_ID}&serverurl={!$Api.Partner_Server_URL_220}&recordid={!Account.Id}

2) Utility Code:
The utility is on my server for now, it is in BETA, once all is tested and working , i will make it public :)

Note: For commercial use this tool, you first need to go to Uploadify site and check its license type if any. Because my tool uses the Uploadify internally.

See the screen cast how it works:
http://screencast.com/t/ibDqgMBbfQ

Hope you will like it. :)

Thanks
Aslam Bari

Apex Toolkit for Salesforce

Saturday, July 16, 2011 by Aslam - The Alexendra
Hi All,
Its a long time since I last posted :). So i am back with something interesting and useful contents again.
Most of us known that whenever we want to connect with any salesforce org and do query the data with any langugae, salesforce gives us some toolkit like PHP toolkit, Java toolkit, Ruby Toolkit, Flex Toolkit etc. But what when we want to connect with a remote Salesforce instance within salesforce only, using native Apex language. People use many alternate to achieve it, some uses partner wsdl to generate apex or some uses javascript toolkit. But I find them not easy to use and not easy to setup and they did not fit in my need.
So I come up with my own Apex Toolkit for Salesforce :)




Its easy to install package. You can install it from here:
https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Priq

For successful connectivity to any remote instance one entry for that salesforce server TYPE must be there in your remote site setting. I have by default included in package (NA1 to NA7) server url for salesforce. You can add more like (CS1 - CS9, NA1 - NA11, AP1 - AP10). For example see the below screen shot how i added most likely used server instances in my remote site settings. There must be 20-25 possible entries at most in my opinion.



It is very easy to use with only simple some lines of code to login and do a query to remote instance as below:

SFConnectionController controller = new SFConnectionController();
LoginResult loginResult
= controller.login(username, password, securityToken);
Response response
= controller.query('select Name, Email, Phone, MailingCity, MailingCountry from Contact', loginResult);
for(Record row: response.data.records){
string Name
= row.getFieldValue('Name');
string Email
= row.getFieldValue('Email');
string Phone
= row.getFieldValue('Phone');
string MailingCity
= row.getFieldValue('MailingCity');
string MailingCountry
= row.getFieldValue('MailingCountry');
}


There is one demo page and controller in package which shows how to use this functionality.
SFConnectionDemo
SFConnectionDemoController

The toolkit is just a start and gives users facility to do login and do simple queries on objects. One can easily extend this for better version. If you want to contribute in this, i have shared this project as open source here:

http://code.google.com/p/apex-toolkit-for-salesforce/

Here is one running online demo which shows how this package works. Just give your developer/production org's username, password (or securityToken as well), and click on search button. It will fetch the contact records from your organization and will display in table below.

http://labsprojects-developer-edition.ap1.force.com/SFConnectionDemo

Hope you will like it :)
Mail me for any configuration or setup issues and for feedback.

Thanks
Aslam Bari

Authorize.Net Apex Library: Salesforce and Authorize.Net Integration

Saturday, May 28, 2011 by Aslam - The Alexendra
Hi All,
Recently I came across one requirement where end user wants an easy way to pay fixed amount online from Salesforce to third party something like Donate page. In one of my previous post i showed you how you can do that using Paypal. Here is that paypal solution:
http://techsahre.blogspot.com/2011/01/simple-paypal-integration-with.html

I was thinking to implement the same thing but this time end user wanted something simpler easy to use and easy to test solution. Then i found that 'Authorize.Net' is one of the good solution for this type of requirements. Then i created one simple ready to use online payment tool in salesforce using 'Authorize.Net' as payment gateway.



I found a good tutorial here in PHP how to make that here. I used the same idea and rebuild my Apex solution.

You can download the package from this link:
https://login.salesforce.com/?startURL=%2Fpackaging%2FinstallPackage.apexp%3Fp0%3D04t90000000PqIH

Before using the tool, you first need to follow some basic things:

1) For checking/testing the things you need first test accounts. Go to "test account" page on Authorize.Net and create one merchant account (Card Not Present).

2) Change your "login" and "transkey" variables in "AuthorizeDotNet" class with the merchant account's API login id and transaction id.

After that you can simply use VF page "DoPayment" to see how this works.
/apex/DoPayment



On click of submit you will get information about your transaction, if successful it will show you transaction id and success message. Otherwise will show error message.

Check out this easy cool stuff and give me feed backs as always.


Thanks
Aslam Bari

Making Related List without using Apex Class

Thursday, May 5, 2011 by Aslam - The Alexendra
Hi All,
Here i want to give some sample code to show you how to make RelatedList on your VF page without using any Apex Code. There are two solutions for this problem.

1) Using <apex:relatedlist>
Suppose you have standard Case object and have one custom child object named "Child__c" to case. Then you can show your relatedlist on vf page using below code.

<apex:page standardController="Case">
<apex:relatedList list="Childs__r"/>
</apex:page>

The list will be displayed on your page but it always gives "Action" column also with "Edit | Del" links. If you want to get rid off that then you need to do a little jquery trick to remove that. See the below code.

<apex:page standardController="Case">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>

<script>
$(document).ready(function(){
$('#Childs a').attr('target','_blank');
});
</script>

<style>
.pbButton{
display:none;
}
.actionColumn{
display:none;
}
</style>

<Div id="Childs">
<apex:relatedList list="Childs__r"/>
</Div>

</apex:page>

The main issue i found using above approach of making list is that it depends on fields selected on page layout for that relatedlist. If you have added 2 fields on your layout, your vf will also show two fields. If you remove that related list from layout, then your vf will show only default fields ( name) only. So, in some sitations this solution is not perfect. For that reason, here is another solution.

3) Using relations objects iteration and Standard Tags.
Here is the other way to achieve your related list on vf page:

<apex:page standardController="Case">
<apex:sectionHeader title="http://www.aslambari.com" subtitle="Related List Example"/>
<apex:pageBlock>
<apex:pageBlockTable value="{!Case.Childs__r}" var="child">
<apex:column headervalue="Name"><apex:outputLink value="/{!child.id}">{!child.name}</apex:outputLink></apex:column>
<apex:column value="{!child.detail__c}"/>
<apex:column value="{!child.is_active__c}"/>
<apex:column value="{!child.createddate}"/>
<apex:column value="{!child.createdbyId}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
Here is a working demo for above code sample:
http://labsprojects-developer-edition.ap1.force.com/apex/RelatedListSample?id=50090000000sW5q


The above way, you can customize your list as you want.

Hope It helps developers to find quick solution for related list.

Thanks
Aslam Bari

Salesforce Native DatePicker Year Extending Component

Saturday, April 23, 2011 by Aslam - The Alexendra
Hi All,
I developed one simple and useful component to extend Native Salesforce DatePicker. You all must aware of that we can't change Year list in datepicker and have to depend of salesforce native year list which is about -1 to +5 of current year. This is not useful on many situation like if i need to make one Date Of Birth field or any other date field where i need years range some high.



So i came up with simple component solution for this of your VF page. You simply need to include this in your VF page and use as following.

Sample Usage:
1) By using "lowerLimit" and "higherLimit"
<c:datepickerextend lowerlimit="10" higherlimit="15"/>
It will pick first year available in picker year list , for example 2010, and then add 10 earlier years to top of the picklist.
Same for higherLimit, it will pick last year available in picker year list, for example 2016, and then add 15 later years to bottom of the picklist.

2) By using "startYear" and "endYear
<c:datepickerextend startYear="1982" endYear="2020"/>
It will simply fill year list from 1982 to 2020.

Downloads
----------------------------------------------------
1) Component Code: Download from here
http://www.aslambari.com/datepick_extend/DatePickerExtend.txt

2) jQuery Lib: Download from here and save in static resource as datepicker_extend (You can you any jquery lib instead)
http://www.aslambari.com/datepick_extend/jquery-1.5.2.min.js

3) Demo Usage Code: Download from here
http://www.aslambari.com/datepick_extend/DemoUsageCode.txt


Working online demo:
You can view one simple demo, used following code:

<c:datepickerextend lowerlimit="10" higherlimit="5"/>

http://labsprojects-developer-edition.ap1.force.com/DatePickerExtendDemo


Provide your feedback as always. Enjoy !!!

Thanks
Aslam Bari

SF Ballot : Native Poll System For Salesforce

Saturday, April 16, 2011 by Aslam - The Alexendra
Hi All,
Today i came up with one new tool i created "SF Ballot". This is a small application tool used for polling/voting for Salesforce internal users, customer portal users and others with native support. It is easy to setup and integrated with sidebar for users. Users can submit and see result easily for their daily polls. Admin can easily creates new poll daily for users.



You can download the package from this url:

https://login.salesforce.com/?startURL=%2Fpackaging%2FinstallPackage.apexp%3Fp0%3D04t90000000DNdg

Here is the detailed information about this tool. You can find screencast also there and updated info about the tool.

http://www.aslambari.com/sf_ballot.html

Try this out and give me feedback about your experience with this.

Thanks
Aslam Bari

Useful Apex Functions Solution "SFApexUtilFunctions"

Thursday, March 31, 2011 by Aslam - The Alexendra
Hi All,
Most of time while devleoping Apex Code, we face many business requirements for which we develop our own logic and methods. Most of us written many useful methods so far in their development. So, my idea is simple. I welcome all of you to contribute your common useful apex methods with me and complete my "SFApexUtilFunctions" class. I have started this class with some of my reused methods. If we all contribute our useful methods then i am sure we will have a good library written which will be useful for all of us.

The format for contributing your methods will be like given as per below with the proper comments on method top describing method and author. You can post in blog itself or mail me. I will inform the newly added methods to all and update the actual class also. One can download the latest version of class from this url:

http://www.aslambari.com/SFApexUtilFunctions.cls




/**
@ Name SFApexUtilFunctions
@ Author Aslam Bari
@ Created Date 31 March, 2011
@ Description A utility methods class for helping developers community
*/
public class SFApexUtilFunctions{

/**
@ Name join
@ Author Aslam Bari
@ Created Date 31 March, 2011
@ Desctiption Join one list of String to a full string
@ Param List<String>: list of string data
@ Param separator: the string by which the list is joined
*/
public static string join(List<String> lstArg, String separator){
String fullString
= '';
for(String item: lstArg){
fullString
+= item + separator;
}
if(fullString.length() > 0)
fullString
= fullString.substring(0, fullString.length() - 1);

return fullString;
}

/**
@ Name getUrlContents
@ Author Aslam Bari
@ Created Date 31 March, 2011
@ Desctiption Fetch the contents of remote url
@ Param url: remote url with all parameters attached to url for GET call
*/
public static string getUrlContents(String url){
HttpRequest request
= new HttpRequest();
request.setEndPoint(url);
request.setMethod(
'GET');
Http call
= new Http();
HttpResponse response
= call.send(request);
return response.getBody();
}
}



So start now and lets contribute :)

Thanks
Aslam Bari