Friday, July 15, 2011

Send Web Request & XML Parsing

Hello all ,

Here is a complete procedure to send an HTTP web request and parse an XML response returned from the server.

To Do this you must relate your webserver address under remote settings. To do this follow the following steps:

1) Goto Setup under your Name

2) On left pane you can see Administration Setup. Click on Remote Site Settings


3) Click on New Remote Site and register the url


Now you can make requests.

Send Request: In this method i have also used a Method to do encoding

EncodingUtil.urlEncode('varible whose value you wish to encode','Encoding Method').
sig is just a variable that i wish to encode and append in the url.



Parsing: We are using DOM Parser here.It analyses the root elements, walks through each child element and fetches the values.








Enjoy hope it helps in Salesforce
:)

Publish record to Workspaces (Libraries)

Hello all,

I had a hard time searching about how to publish record to workspaces(now Libraries).
but finally i achieved it.Thanks to those who helped me & trusted too.

Here you go:

Publish to SHARED WORKSPACE:


Workspace Name is the choice given by user where he wants to publish the contents
There is also an option if you specify FirstPublishLocationId as id of the shared workspace to which you wish to publish, then you need not to specifically add it to workspace.Just add this line: 

and remove the docLink feature that you can see in the first image.


Publish to PERSONAL WORKSPACE:


doc.FirstPublishLocationID :  We provide user id here indicating that we want to publish the content to the particular user's library.This is necessary to do as there is no API to fetch users personal library Contents.

I have created blobs for testing .You can create blobs depending upon your requirement.
Enjoy Salesforcing.

Monday, July 4, 2011

Update Chatter in VisualForce Page

Hello Chatter feature in Salesforce acts like notification.
You can see the latest activity of the users.

Suppose after uploading a file to server you want to display a notification in chatter then proceed like this:

1) Click on "Start Upload" Button:

2) This is actually apex command button.
3) call a method on its action



4) The action attribute fires a method of a controller class:


5) After uploading or when certain task is finished depending upon users requirement a message is displayed in Chatter like this:


  
Enjoy Salesforcing
:)