-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
3Questions
-
3Replies
How to escape a string in the query passed to data loader command line tool
Hi,
I am using the data loader command line tool to extract data out. For one object, I only want to extract data that meets certain criteria. How do I specifiy a string value in the sfdc.entity field?
$JAVA_HOME/jre/bin/java -cp $FILE_BASEDIR/DataLoader.jar \
-Djava.io.tmpdir=$LOGDIR -Dsalesforce.config.dir=$FILE_BASEDIR/config \
com.salesforce.dataloader.process.ProcessRunner process.name=extract \
process.lastRunOutputDirectory=$LOGDIR \
process.statusOutputDirectory=$LOGDIR \
dataAccess.name=$DATADIR/$STAMPFOLDER/57_Standard_kav_01.csv \
sfdc.entity=Standard__kav \
sfdc.extractionSOQL="select ID,Title,Summary from Standard__kav where PublishStatus=\'Online\'"
I am gettingan empty query error
2012-02-14 15:38:54,306 ERROR [extract] action.ExtractAction getColumnsFromSoql (ExtractAction.java:235) - Error in query: query is empty
2012-02-14 15:38:54,307 ERROR [extract] progress.NihilistProgressAdapter doneError (NihilistProgressAdapter.java:51) - Error in query: query is empty
I was able to extract data with the same set up for those that don';t have the where clause.
Does anyone know how to escape the string value in the where clause?
-
- stephanie_z
- February 15, 2012
- Like
- 0
- Continue reading or reply
How to read cookie values in remote method
I have a class which only provides remote methods for AJAX calls. In one of the methods, I need to read a cookie which is set by other pages. I tried to use ApexPages.currentPage().getCookies().get(<cookiename>), but it doesn't work since ApexPages.currentPage() is null. I guess it might be because the class is not associated with any VF. Is there any other way to fetch cookie values in remote methods?
-
- stephanie_z
- December 21, 2011
- Like
- 0
- Continue reading or reply
Unable to use JSON.deseralize to deseralize an object which contains a list of another object
Hi,
I am deseralizing the json string into an object which contains a list of another object, and getting this error:
Internal Salesforce Error: 17692538-4726 (1351590007) (1351590007) |
My code has been working up until this Wednesday. Was there any change that has been applied to cs2 env? This the test code I have:
public with sharing class JSONTest {
public class InvoiceStatement {
Long invoiceNumber;
Datetime statementDate;
Decimal totalPrice;
public InvoiceStatement(Long i, Datetime dt, Decimal price)
{
invoiceNumber = i;
statementDate = dt;
totalPrice = price;
}
}
public class InvoiceStatementResponse {
Integer errorCode;
List<InvoiceStatement> statements;
public InvoiceStatementResponse(Integer errorCode) {
this.errorCode = errorCode;
statements = new List<InvoiceStatement>();
}
}
public static void SerializeRoundtrip() {
Datetime dt = Datetime.now();
// Create a few invoices.
InvoiceStatement inv1 = new InvoiceStatement(1,Datetime.valueOf(dt),1000);
InvoiceStatement inv2 = new InvoiceStatement(2,Datetime.valueOf(dt),500);
// Add the invoices to a list.
List<InvoiceStatement> invoices = new List<InvoiceStatement>();
invoices.add(inv1);
invoices.add(inv2);
InvoiceStatementResponse resp = new InvoiceStatementResponse(0);
resp.statements = invoices;
String JSONString = JSON.serialize(resp);
System.debug('Serialized list of invoices into JSON format: ' + JSONString);
InvoiceStatementResponse dresp = (InvoiceStatementResponse)JSON.deserialize(JSONString, InvoiceStatementResponse.class);
System.debug('dresp=' + dresp);
}
private static testmethod void mytest() {
JSONTest.SerializeRoundtrip();
}
}
Any help is appreciated.
-
- stephanie_z
- October 28, 2011
- Like
- 0
- Continue reading or reply
How to escape a string in the query passed to data loader command line tool
Hi,
I am using the data loader command line tool to extract data out. For one object, I only want to extract data that meets certain criteria. How do I specifiy a string value in the sfdc.entity field?
$JAVA_HOME/jre/bin/java -cp $FILE_BASEDIR/DataLoader.jar \
-Djava.io.tmpdir=$LOGDIR -Dsalesforce.config.dir=$FILE_BASEDIR/config \
com.salesforce.dataloader.process.ProcessRunner process.name=extract \
process.lastRunOutputDirectory=$LOGDIR \
process.statusOutputDirectory=$LOGDIR \
dataAccess.name=$DATADIR/$STAMPFOLDER/57_Standard_kav_01.csv \
sfdc.entity=Standard__kav \
sfdc.extractionSOQL="select ID,Title,Summary from Standard__kav where PublishStatus=\'Online\'"
I am gettingan empty query error
2012-02-14 15:38:54,306 ERROR [extract] action.ExtractAction getColumnsFromSoql (ExtractAction.java:235) - Error in query: query is empty
2012-02-14 15:38:54,307 ERROR [extract] progress.NihilistProgressAdapter doneError (NihilistProgressAdapter.java:51) - Error in query: query is empty
I was able to extract data with the same set up for those that don';t have the where clause.
Does anyone know how to escape the string value in the where clause?
- stephanie_z
- February 15, 2012
- Like
- 0
- Continue reading or reply
Unable to use JSON.deseralize to deseralize an object which contains a list of another object
Hi,
I am deseralizing the json string into an object which contains a list of another object, and getting this error:
Internal Salesforce Error: 17692538-4726 (1351590007) (1351590007) |
My code has been working up until this Wednesday. Was there any change that has been applied to cs2 env? This the test code I have:
public with sharing class JSONTest {
public class InvoiceStatement {
Long invoiceNumber;
Datetime statementDate;
Decimal totalPrice;
public InvoiceStatement(Long i, Datetime dt, Decimal price)
{
invoiceNumber = i;
statementDate = dt;
totalPrice = price;
}
}
public class InvoiceStatementResponse {
Integer errorCode;
List<InvoiceStatement> statements;
public InvoiceStatementResponse(Integer errorCode) {
this.errorCode = errorCode;
statements = new List<InvoiceStatement>();
}
}
public static void SerializeRoundtrip() {
Datetime dt = Datetime.now();
// Create a few invoices.
InvoiceStatement inv1 = new InvoiceStatement(1,Datetime.valueOf(dt),1000);
InvoiceStatement inv2 = new InvoiceStatement(2,Datetime.valueOf(dt),500);
// Add the invoices to a list.
List<InvoiceStatement> invoices = new List<InvoiceStatement>();
invoices.add(inv1);
invoices.add(inv2);
InvoiceStatementResponse resp = new InvoiceStatementResponse(0);
resp.statements = invoices;
String JSONString = JSON.serialize(resp);
System.debug('Serialized list of invoices into JSON format: ' + JSONString);
InvoiceStatementResponse dresp = (InvoiceStatementResponse)JSON.deserialize(JSONString, InvoiceStatementResponse.class);
System.debug('dresp=' + dresp);
}
private static testmethod void mytest() {
JSONTest.SerializeRoundtrip();
}
}
Any help is appreciated.
- stephanie_z
- October 28, 2011
- Like
- 0
- Continue reading or reply
JSON Parsing to list of custom object type error
Hey all.
I am working with the new JSON Parsing functionality, and am hitting a bit of snag trying to parse some JSON into a list of custom objects. The exact error is
Internal System Error: 1094975380-22831 (-1000130141)
Which looks like there is probably an issue with the JSON parser. I have been able to parse single instaces of an object, but have not been able to do with with a list of them yet.
Here is what the code looks like.
public class surveyAnswer { Id contact; Integer surveyId; String questionText; String questionId; String questionAnswer; public surveyAnswer(Id c, Integer s, String qt, String qi, String qa) { contact = c; surveyId = s; questionText = qt; questionId = qi; questionAnswer = qa; } } string jsonString = '[{"questionText":"BLah 1","questionId":"51345X1607X53053","surveyId":51345,"questionAnswer":2.0,"contact":"0034000000UefNI"},{"questionText":"Blah 2","questionId":"51345X1607X53100","surveyId":51345,"questionAnswer":3.0,"contact":"0034000000UefNI"},{"questionText":"blah 3","questionId":"51345X1607X53101","surveyId":51345,"questionAnswer":1.0,"contact":"0034000000UefNI"},{"questionText":"blah 4","questionId":"51345X1607X53103","surveyId":51345,"questionAnswer":1.0,"contact":"0034000000UefNI"}]'; list<surveyAnswer> answers = (List<surveyAnswer>)JSON.deserialize(JSONString, List<surveyAnswer>.class);
I thought it might be a problem with the JSON structure, but it validates just fine in JSLint, so it should be fine. This approach should be doable according to the docs at
http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_methods_system_json.htm#apex_methods_system_json
Any help would be much appreciated. Thank you!
- Kenji775
- October 24, 2011
- Like
- 0
- Continue reading or reply