Wednesday, March 28, 2012

Inserting/Import Attachments using Apex Dataloader in Salesforce


Once I came to know we can able to extract the Notes and attachments from an object using Dataloader, I thought importing the attachment is also the same and we can do it very easily in the same manner but I was wrong.


Let us see how we can do this using dataloader,but before that please recall How to Import/Export Notes and Attachment through DataLoader in Salesforce

For importing or inserting an attachment to an object (say Account) we need the following details in the CSV file that we are going to use in the Data loader.

PARENTID
NAME
CONTENTTYPE
BODY
OWNERID


PARENTID:
This is nothing but the Salesforce ID of the Parent object record(Say AccountID).

NAME:
Name is the name of the attachment file.

CONTENT TYPE:

The File Format eg: Doc,txt,xls,pdf..

BODY:
This one plays an important role while importing an attachment.
We must give the Path of the attachment in the local Machine.
Make sure the File must follow with its extensions i.e .pdf,.doc.xls, etc

Example: C:\Program Files\salesforce.com\Data Loader\Test1\Attachments\TestDoc.doc


OWNERID:

The user Profile.

 After filling up all these details in the CSV file load this file in data loader and Map the respective fields and Insert the file into Salesforce with Dataloader.

How to Import/Export Notes and Attachment through DataLoader in Salesforce


          We all know that we can do Insert, Upsert, Delete, Extract data from and to the Salesforce environment with the help of Apex Data Loader. When I was thinking is it possible to do all the above operations with Attachments and Notes which can be attached to some objects like Accounts, Opportunities, etc. I got to know that we can do the CRUD operations in Attachments and Notes also.

Let us see how we can achieve this using the Apex Data Loader.

In Data Loader after we select the operation which we need to perform by default we are not able to see the “Notes” and “Attachment” objects “Select Salesforce Objects” dialog box.

In order to view the Notes and Attachment objects Just Check in the “Show All Salesforce objects” check box available just at the top of the Object select field.


That’s it we can now be able to do all the CRUD operations in Notes and Attachment..


Most important 

Find the full details of performing the CRUD operations here

Sunday, March 18, 2012

Batch Upload of Data to related objects in Salesforce

I have been storming my mind for about a week to get an answer for performing batch upload of data into related objects for my Salesforce Environment . Once I found I felt shame on me asking " Why Don't you think in that way, wasting a week?"

Before looking into that first have a glance of "Automation of Data Loader From Command Line for Salesforce"

I was thinking how we can upload data into related objects (like Account and Opportunity) that are having Parent-Child Relationship and I found this simple solution.

All we know that if we want to load a child record to a parent we need the Salesforce ID created for that parent object.For example if we want to load an opportunity to an account first we need to give the Account IDof the account in the CSV file that we are uploading for the opportunity.

But it will be very complex if we want to do all four activities in one go i.e. 
i.Inserting an account
ii.Extracting the account id
iii.Mapping the Account id to the Opportunity data
iv.Inserting the Opportunity data

To do all this, we need to alter the mapping file only
In the mapping file used for inserting an opportunity we need to change the mapp for the Account ID field.

i.e the syntax should be like this.

AccountID=Account:\Extrnal_Id__c

where External_Id__c field is the External ID field in the Account object.

That's it we can run the batch process for data loading in related objects....

Saturday, March 17, 2012

Batch Processing for Data Loader in Salesforce


We can run a batch process of Data Loader using command line to automate Data Loader to perform CRUD operations. All we have to do is to create a batch file to call all the process that we need to execute in the batch process by mentioning the Bean Id.
For example:

"cls
call process "Path where Config.properties file available" AccountExtractProcess 
cls

call process "Path where Config.properties file available" OpportunityExtractProcess"


That's it we can run data loader as batch process for Salesforce.

Automation of Data Loader From Command prompt for Salesforce


This post is for Data Loading using command prompt, I have already shared the required files for this automated process in "Data Loader Using Command Prompt",here  I will be sharing how to run this in command prompt.

For running in command prompt we need "Process.bat" file which can be accessed in
"C:\Progam Files\salesforce.com\DataLoader\bin"

Okay for your testing purpose create a test folder with any name say " Test " and copy down all the required files that I have mentioned in the "Data Loader Using Command Line" post.

Now open Command prompt and navigate to "bin" folder in command prompt then run the "Process.bat" file with the syntax

Process.bat "Path to the Test folder" <Bean Id for the process that we are going to execute>

ex: Process.bat "C:\Progam Files\salesforce.com\DataLoader\Test\" AccountExtractProcess

That's it now you can do CRUD operations from Command Line ..

Using Apex Data loader from command prompt


Recently I came with a task of uploading data in salesforce automatically, I found that we can use command prompt for this purpose. All we need is to have the following files

         Config.properties
         Process-conf
         Mapping Files
         Data Files

Config.Properties:

This file contains all the configuration properties for Data Loader including the UserName and Encrypted Password of your Salesforce Environment and Proxy Address Info.
This file can be accessed from
for XP: "C:\Program Files\Salesforce.com\Data Loader\conf
for Vista: "C:\Users\'UserName'\AppData\Roaming\Salesforce.com\Apex Dataloader\"

Process-conf:

This XML file contains all the operations we will be doing in Data Loader i.e Insert Operation,Delete Operation,Upsert operation,Extract Operation, Update operation. This file is can be accessed from

for XP: "C:\Program Files\Salesforce.com\Data Loader\conf
for Vista: "C:\Users\'UserName'\AppData\Roaming\Salesforce.com\Apex Dataloader\"

Mapping Files:

These are ".SDL" files which can be used to Map the data in our ".CSV" file with different fields in our salesforce environment.This files can be generated automatically once we use Data Loader for any CRUD operation.

Data Files:

These files are the files that contain our actual data to be used for any of the CRUD operation.These files should be of .CSV type.

Check Out How to run this Data loading from command prompt

Friday, March 16, 2012

Im In Cloud

Yes Guys I'm in cloud, after being worked for about 1 year with Salesforce.com I'm pretty interested with this CRM tool. Now I created this blog just to share the knowledge which I learnt from Salesforce.

I want to share another important thing too, that is nothing but I am a Salesforce.com certified Developer, Hard to believe it right!!! But you have to do that....



I will not be sharing much of the coding stuffs here but I will share whatever I will come across some small small stuffs in Salesforce.