从salesforce获取数据。以下函数从salesforce获取当前登录用户的数据。
function init() {
// Get an instance of the REST API client and set the session ID
var client = new forcetk.Client();
client.setSessionToken(getValueFromCookie("sid"));
// Retrieve the data representing the current user
client.currentUser(function(response){
var user = response;
console.log(user);
// Find cases that belong to the current user
client.query("SELECT Name FROM User", function(response){
console.log(response);
Tinycon.setBubble(response.totalSize);
});
});
}
现在我想在当前用户中通过forcetk在salesforce中插入一个潜在客户,该用户已登录。