1

In the mapping file for command line data loader we can map column name to the salesforce field

BillingCountry=BillingCountry

or a constant value to the salesforce field

"United\ States"=BillingCountry

Is there a way we can provide concatenation of both like

"This is Country"&BillingCountry=BillingCountry

I have tried the following but all of them loading blank values to BillingCountry

"This is Country"&BillingCountry=BillingCountry
"This is Country"&&BillingCountry=BillingCountry
"This is Country"+BillingCountry=BillingCountry

Scenario:

We have a developer sandbox which gets refreshed every month. Our support team loads the data exported from Production into this sandbox using data loader. We are requested to automate that.

We stuck at data loading Document records to the sandbox. We extract Document with the following mapping

FolderId=FolderId
Name=Name
DeveloperName=DeveloperName
ContentType=ContentType
Type=Type
IsPublic=IsPublic
Description=Description
NamespacePrefix=NamespacePrefix

Currently we open the extracted csv, add a column named Body with "E:\Projects\AJG\Training Sandbox Refresh\Data Load\Data\Images\"&DeveloperName&"."&Type provided the path is having the files and load the data into Sandbox.

We want to eliminate the manual work of opening the csv and manipulating it.

Workaround

Created a batch file to manipulate the csv to create a new csv with the Body column populated as per the requirement and then loading the data to sandbox.

@echo off
setlocal enabledelayedexpansion
set inputCSV=%1
set outputCSV=%2
set url=%3
set url=!url:"=!
if exist "%outputCSV%" del "%outputCSV%"
echo "FOLDERID","NAME","DEVELOPERNAME","CONTENTTYPE","TYPE","ISPUBLIC","DESCRIPTION","BODY">%outputCSV%
for /f "skip=1 delims=" %%C in ('type "%inputCSV%"') do (
    set Line=%%C
    for /f "tokens=3,5 delims=," %%a in ("!Line!") do (
        set Col3=%%~a
        set Col5=%%~b
        set Col3=!Col3:"=!
        set Col5=!Col5:"=!
        set NewCol=!Col3!.!Col5!
        >>"%outputCSV%" echo %%C,"%url%!NewCol!"
    )
)
  • first question is understood i.e. Is there a way we can provide concatenation of both like? what is the 2nd question? – Santanu Boral Jun 28 '17 at 22:22
  • There is no second question. I just provided the scenario where the first question is rised. – Vigneshwaran G Jun 30 '17 at 13:18
0
+50

Is there a way we can provide concatenation of both like

"This is Country"&BillingCountry=BillingCountry

Ans: Salesforce doesn't provide that type of option to concatenate values with column fields in mapping file.

You can define a workflow rule to concatenate the value by workflow field update action.

Otherwise, since you are manipulating csv file through the batch file, better to create a new column, do the concatenation and finally map the new column with BillingCountry in the mapping file.

  • I asked this question to avoid the csv manipulation using Batch jobs. Anyway thanks for the answer. Heading to write Batch jobs now. I have plenty of such. – Vigneshwaran G Jul 4 '17 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.