Osama's Weblog

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

Paypal X toolkit for Force.com

Osama | July 19, 2010

Last month Salesforce.com and PayPal announced Paypal X toolkit for Force.com Platform.

PayPal, as everybody knows is the most commonly used payment gateway in e-commerce world. The important points about PayPal are:

  • Facilitates payments
  • Pay anyone, receive from anyone
  • Account management
  • Tools for information and reporting

PayPal provides its APIs for integration with other e-commerce websites. They recently launched few changes in their system which are :

  • Pre-approval APIs
  • Refund
  • Convert Currency
  • Parallel Payments
  • Chained Payments

Using Parallel payments, you can split a single payment to any number of receivers. For example, a person purchases different items from different sellers. The person doesn’t have to arrange separate transactions for each seller. What he can do is just arrange a single payment which can be distributed among all the sellers. Isn’t it great?

Using Chained payments, you can send one payment to specific merchant who can further sends the payment after keeping his share. For example, you buy a product through a sales rep of an organization. You can arrange a chained payment for this purpose. You will pay to the sales rep and which will be forwarded to the organization’s account after the share of sales rep is deducted.

Force.com PayPal X toolkit is a set of apex classes for accessing API more easily. You can access them through force.com IDE after installing them into your organization. It takes care of transport . It securely manages API credentials. There is a custom object where you store your API credentials. It also supports adaptive accounts. It is easy to access PayPal sandobx sandbox, beta and live environments.
To access it, sign up on X.com. Obtain application ID from MyApps page. Now, create PayPal sandbox test account and signup on  http://developer.paypal.com. Now, Create test accounts for sandbox and obtain API credentials.

Install PayPal X toolkit from code share.

There are sample codes available for every kind of request that PayPal supports.
Now you don’t have to waste your time in writing custom code to integrate PayPal into your system. Just modify the template classes in the toolkit (which is usually the change in API credentials and some other information as required).

More info on this can be found at webinar by salesforce.com.

  • Share/Bookmark
Comments
No Comments »
Categories
APEX, General, salesforce
Tags
force.com, paypal, PayPal X, salesforce
Comments rss Comments rss
Trackback Trackback

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

Enforcing 1:1 relationship in Salesforce.com

Osama | June 3, 2010

I was wondering what if I have to create a one to one relationship between two objects. There is no declarative way where we can specify a one to one relationship between two objects.

We can write a trigger to enforce a one to one relationship between two objects. The trigger can be written on the child object that validates if there is any other record with same Parent record ID. If found then instead of inserting the record, it gives an alert.

The trigger will generate a list of child objects with specified parent ID. If the list’s length that is retrieved is greater than one, it will generate an alert.

List<ChildObject> co = [select name from ChildObject where parentId = ParentId]
If  (co.Size() < 2)
{
//insert
}
else
//generate alert

  • Share/Bookmark
Comments
2 Comments »
Categories
APEX, salesforce
Tags
APEX, salesforce, trigger
Comments rss Comments rss
Trackback Trackback

How to: Retrieve a list of sObjects in Apex

Osama | May 11, 2010

Some one asked me how to retrieve a list of sObjects in an SF organization using Apex and bind it to a picklist in a VisualForce page.

List of sObjects is returned when you hit the schema of your SF organization. You can get the Label of sObjects as well as API names.

The following code snippet shows how to do the above mentioned task

VisualForce page:

<apex:page controller="Schema2" >
<apex:form >
<apex:SelectList value="{!val}" size="1">
<apex:selectOptions value="{!Name}"></apex:selectOptions>
</apex:SelectList>
</apex:form>
</apex:page>

Apex Controller Code:

public class Schema2 {
public String val {get;set;}
public List<SelectOption> getName()
{
List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values(); //extracts the List of sObjects in an organization
List<SelectOption> options = new List<SelectOption>();
for(Schema.SObjectType f : gd)
{
options.add(new SelectOption(f.getDescribe().getLabel(), f.getDescribe().getLabel()));
}
return options;
}
}

Feel free to ask any questions

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

What is VMforce?

Osama | April 27, 2010

“VMForce: The birth of a new cloud …”. The company’s Salesforce, in conjunction with VMware have created a wonderful and powerful ecosystem that can further enhance the power of the cloud.

In an article published by the initiative entitled VMForce: Why? What? How? mentioned: In simple terms, VMforce is a service that will allow any Java developer to create applications that can run directly in the cloud. VMforce provides Java tools “out-of-the-box” which are already pre-integrated with a relational database, a search machine, analysis tools and reporting, user identity management as well as all construction-related services , implementation and management of enterprise-class applications.

VMforce allows developers to use Spring, Java development environment more popular for the rapid construction of applications and instant installation in a runtime environment for enterprise class cloud. This “Framework” is backed by a division of VMware: SpringSource.

For reference, the graphical development environment based on Eclipse SpringSource, making it even more attached to the world of open standards.

True, the fact is not required to purchase a server and middleware to run applications, but it is also possible by Java2 Enterprise Edition to interact with objects in Salesforce. This will allow developers who already have work done on Salesforce.com Salesforce platform, benefiting in the short, medium and long term of the enormous power of Java.

Who benefits from this? First the developers. Both of those companies that are dedicated to providing its development independently, as those who work within companies.

Secondly, the directors of departments of Information Technology, for now there is no need to buy more hardware, have more physical space, require more electricity and / or cooling to accommodate new applications (or existing).

Thirdly and equally important, the Directors-General and Financial companies, to encourage that with the pattern of “Software as a Service” a substantial saving in investment licensing, maintenance and all expenses incurred while installing database engine , middleware, etc. What about the cost of information storage.

Another advantage worth mentioning again is the fact that it has a Quality Level Agreement that guarantees a 99.9997% of time “up” of the application, being only necessary that the end users using only a browser .

The bottom line? The new cloud is born. A cloud attached to robust and open standards. A cloud that has the experience and support of VMware, Salesforce, Oracle and all that now makes up this thing called VMForce.

  • Share/Bookmark
Comments
No Comments »
Categories
General, salesforce
Tags
cloud computing, salesforce, vmforce, vmware
Comments rss Comments rss
Trackback Trackback

VMware, Salesforce.com eye partnership, Virtualization as a service?

Osama | April 12, 2010

VMware and Salesforce.com appear to be launching a virtualization as a service offering based on a teaser Web page posted by the companies.

Details about the effort, dubbed VMforce, are sparse, but the companies promise to “make an exciting joint announcement on the future of cloud computing” on April 27.

VMware CEO Paul Maritz and Salesforce.com chief Marc Benioff will host the powwow. It’s likely the two parties will announce a data center tie up and some sort of virtualization as a service offering.

via ZDNet

  • Share/Bookmark
Comments
No Comments »
Categories
General, salesforce
Tags
cloud computing, salesforce, vmware
Comments rss Comments rss
Trackback Trackback

How to: Attach a file to a record using Web Services in Oracle CRM On Demand

Osama | April 10, 2010

Lot of my readers ask questions regarding file attachment  using Web Services in Oracle CRM On Demand.. I had a requirement of attaching a pdf document to a Service Created.

To do this, first of all, you have to fetch the document to be attached, into a byte array.

 

byte[] byteArray=null;

InputStream inputStream = new FileInputStream(sourcePath);

String inputStreamToString = inputStream.toString();
byteArray = inputStreamToString.getBytes();

inputStream.close();

The next step is to initialize Attachment.

ServiceRequest2.SiebelXmlAttachmentType SiebelXML; //ServiceRequest2 is the namespace that I was using
SiebelXML = new ServiceRequest2.SiebelXmlAttachmentType();
SiebelXML.Value = byteArray; //put the byte array into the attachment value
SiebelXML.AttachmentIsTextData = "false";

Now attach it to a existing service request and update the service request

ServiceRequest2.ServiceRequest1[] SRFileAttach;

   SRFileAttach = new ServiceRequest2.ServiceRequest1[1];

   SRFileAttach[0] = new ServiceRequest2.ServiceRequest1();
   ServiceRequest2.ServiceRequestWS_ServiceRequestUpdate_Input objInputSRFileAttach = new ServiceRequest2.ServiceRequestWS_ServiceRequestUpdate_Input();
ServiceRequest2.ServiceRequestWS_ServiceRequestUpdate_Output objOutputSRFileAttach = new ServiceRequest2.ServiceRequestWS_ServiceRequestUpdate_Output();

ServiceRequest2.ServiceRequest pxySRFileAttach = new ServiceRequest2.ServiceRequest();
SRFileAttach[0].ServiceRequestId =  “ServiceRequestId” //SR Id which to which the pdf file is going to attach

ServiceRequest2.Attachment[] srAtt;
srAtt = new ServiceRequest2.Attachment[1];
srAtt[0] = new ServiceRequest2.Attachment();
srAtt[0].SRId = “ServiceRequestId” //SR Id which to which the pdf file is going to attach

srAtt[0].Attachment1 = SiebelXML;
srAtt[0].FileExtension = "pdf";
srAtt[0].FileNameOrURL =  “filename.pdf";
srAtt[0].DisplayFileName =  “DsiplayFileName”
SRFileAttach[0].ListOfAttachment = srAtt;

objInputSRFileAttach.ListOfServiceRequest = SRFileAttach;

pxySRFileAttach.Url = //create the session
objOutputSRFileAttach = pxySRFileAttach.ServiceRequestUpdate(objInputSRFileAttach);

I think there is nothing much left to explain after writing the code. I hope it helps to other.

Feel free to consult me if you have any queries/concerns regarding this code or any problem in Oracle CRM on Demand.

  • Share/Bookmark
Comments
1 Comment »
Categories
.NET, General, Oracle CRM on Demand
Tags
Attachment, Oracle CRM on Demand
Comments rss Comments rss
Trackback Trackback

How to schedule a windows service in .NET

Osama | March 29, 2010

I had a requirement of automate a task which could run after every 5 minutes. After spending some time on research, I decided to make a windows service and automate it. Automating a windows service is a bit tricky and it gave me a little hard time. Hence, I am sharing what did I code to complete the task.

When a new service created, OnStart & OnStop methods are initialized by default. You need to play with timers to get the task done.

Below is the code snippet which shows how to automate the windows service.

public partial class Service1

      {
        public Timer tm;  //initialize a new timer instance
        public Service1()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            tm = new Timer();
            tm.AutoReset = true; //timer will reset and call the event handler function itself
            tm.Interval = 60000;  // time interval in milliseconds
            tm.Elapsed += new ElapsedEventHandler(timer_start);  //event which needs to be fired

            //once the timer reaches its maximum value
            tm.Start(); //start the timer

        }

protected void timer_start(object sender, ElapsedEventArgs e)

{

    //Perform your task here

}

protected override void OnStop()
        {
            tm.Start(); //start the timer again and it will call the event hander function again
        }

The above mentioned code snippet is self explanatory. I hope it helps whoever reads the post.

Feel free to ask questions

  • Share/Bookmark
Comments
No Comments »
Categories
.NET, General
Tags
.NET, scheduled, timer, windows service
Comments rss Comments rss
Trackback Trackback

Passing values to iframe from parent window through QueryString

Osama | March 14, 2010

I had a requirement of calling a web page which shows nothing but does some processing at the back end. But later on I decided to put a progress bar to make it attractive. I used JQuery UI to show the progress bar. The issue is JQuery is a javaScript library and it runs after the server side code is done processing. And my code was on the Page_Load method.

The solution which I found was to call the processing page within an iframe of the parent page. So that the progress bar will be shown on the parent page and will be loaded as soon as the page loads and the processing will be done within an iframe.

This is what I did to implement the above scenario:

///////////////Parent Page///////////////
<form id="form1" runat="server">
<iframe id="ifrm" frameborder="0"  runat="server" />
</form>

Code behind of the parent page:
protected void Page_Load(object sender, EventArgs e)
{
ifrm.Attributes["src"] = "Default2.aspx?id=" + Request["id"];
}

This will pass the id in the query string from the parent window the the iframe page. The iframe window will get the id from the query string and will do the desired processing.

Feel free to ask questions

  • Share/Bookmark
Comments
No Comments »
Categories
General
Tags
.NET, iframe, jquery, queryString
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

« Previous Entries

My status

Categories

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

MM Did You Know?

A duck`s quack doesn`t echo. No one knows why.
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

  • koi baat nahin aajeygi samajh...practice karo :pRT @ishezi: @osamanasir @calyps i do not understand a word u both r saying :P 1 day ago
  • @calyps thne ones comng these days only require yoghurt 1 day ago
  • loving tge new image viewer in #hotmail 1 day ago
  • @ishezi yeah tab he without upper ;) 1 day ago
  • @ishezi bahut hai...right now its 9 here 1 day ago
Get Adobe Flash playerPlugin by wpburn.com wordpress themes
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox