【发布时间】:2012-12-13 14:43:09
【问题描述】:
我正在使用 REST API 将对象插入 Salesforce。我有一个具有地理位置数据类型的字段。 如何使用 java 向该字段插入值?我的示例代码如下。
parishud.put("gps__c",?????);
有两个字段要插入(gps(Latitude) gps(Longitude)) 但在 API 中我只找到一个名为 gps__c 的字段
HttpClient client = new httpclient.HttpClient();
JSONObject parishud = new JSONObject();
try {
parishud.put("Name","ParishudhTest4");
parishud.put("entitled__c","Yes");
parishud.put("Comments__c","Comments");
parishud.put("fallill_count_after__c","5");
parishud.put("fallill_count_before__c","7");
parishud.put("influencedcount__c","8");
parishud.put("toiletusaseperday__c","3");
parishud.put("parishudhid__c","002");
parishud.put("Received_NBA_Incentive__c","Yes");
parishud.put("Received_NREGA_Incentive__c","Yes");
//parishud.put("gps__c",?????);
PostMethod postaccount = new PostMethod("https://ap1.salesforce.com/services/data/v20.0/sobjects/Parishudh__c/");
postaccount.setRequestHeader("Authorization", "OAuth " + accessToken);
postaccount.setRequestEntity(new StringRequestEntity(parishud.toString(),"application/json", null));
client.executeMethod(postaccount);
【问题讨论】:
-
我可以插入没有 gps__c 字段的对象。
标签: salesforce force.com