Monday, May 30, 2011

Uploading documents in Salesforce

Uploading documents in Salesforce

Following are the ways to upload the documents in Salesforce:

1) Documents tab : Uses document object
This is generally used to store Web resources, such as, logos, files, some kind of templates and other Visualforce materials in folders. Also note that you cannot associate the documents with any record.

Maximum file size:
5 MB
20 KB for a custom-app logo

2) Notes and Attachments : Uses Attachment object
Attach files to records from the Attachments related list on selected detail pages. You can add a file to a specific record, like an event, contact, or case or any custom object by attaching it on the Attachments related list. You can also insert the file into Attachment object using API. On the visualforce page you need to use tag and using Attachment Object in class and you can associate it with record by using Parent Id field of Attachment object. The attachment inserted will be visible in Notes and Attachment related list of that record.

Maximum file size
5 MB for file attachments

3) Google Docs
Salesforce and Google Apps allow you to integrate Google Docs with Salesforce.
Firstly create a Google Apps account for your organization. It can be done by going to setup| Google Apps| Settings.
After following those steps activate add Google docs to Salesforce. It just requires simple activation from Salesforce Admin.

You can associate Google docs with Salesforce records even when you are not working in Salesforce by using the Add Google Doc to Salesforce browser button just by click of a button.
Add Google docs to Salesforce CRM Content, allows you to manage all types of content in a centralized location.

The docs can be associated with the record. This can be done by going to the record, adding the doc by using Google docs and attachment related list.

Google docs can be also published to Salesforce CRM Content library. When you save or publish you get the dialog box of Salesforce CRM content. Select the library and you can share the doc with members of that library or you can keep it private and store in your personal library.

Maximum file size:
To use a Google Apps service in Salesforce, you must be logged in to your Google Apps business account. Business accounts use your organization's domain. So a User (Google Apps Administrative Contact) will be present who will act as admin and have to register username and password. This becomes tedious to have user name password registered for all users and maintain them.

4) Salesforce Workspaces: Uses Content Version and Content document object.
Create, clone, or modify docs and save it so only you can see it and work on it. When you're ready with final copy, publish it so other users in company have access to it. You can create content delivery and send the link to customers so they can access the document.

Documents are stored in content document object and associated with Workspaces using Content Workspace. Content Workspace Doc is the junction object which stores Content Document ID and Content Workspace ID.
You can go to workspace and publish document there. You can use API as well for same. Use Create Version Object and create a document and insert it. The document will be created as Content Document. It can be associated with records and will be visible in Content documents related list. You can delete the document by deleting content document created using content document object.

Maximum file size:

5) MyFiles in chatter
Allows you to easily upload, store, find with Salesforce Global Search, and follow files you own or have access to from Salesforce Content or Chatter. The Files tab supports all file types up to 100MB each. You can share files here with Chatter or by creating groups. You also have a private section so no other users in the Salesforce CRM system can see them. The Files tab requires no admin setup and is ready to use when Chatter is enabled. Since this integrates with Chatter and Content, think of this as a central repository where all files from those two can be accessed if you have the proper permissions.
You can store the document in myFiles using API as well. You need to store the content as content document in personal workspace and provide ‘origin’ field in content version object as ‘H’. (origin is a picklist field in content version object and has two values ‘C’ and ‘H’. C denotes the file is in users personal workspace and ‘H’ denotes Chatter files from User’s myFiles.). This will insert the document in myFiles.
You can also share the file later on with any record by posting the file into content of the record by using contentPost.

Maximum file size:

Note: Limitation for storing the documents becomes 10MB for Salesforce Workspace and myFiles if you use visualforce page for uploading the document. This is due to the limitation on the visualforce page side.

Monday, May 16, 2011

Using Map in Pageblock table in Visualforce pages

I was not aware that we can use Map in pageblock table in Visualforce pages.
Whenever I had came across something which had duplicate results then I used to prepare Map and then extract List as values from Map and return that List to Page Block Table.

Now after I came across this post then i came to know that Map can be used in Visualforce pages.
Just prepare the Map and return the Map. Use the Map in following ways in Page Block Table in VF page.

 <apex:pageBlockTable value="{!data}" var="d">  
<apex:column headerValue="Key Values">
<apex:column headerValue="Values">

refer original post at following link