2016-11-02 78 views
0

我與JSForce圖書館合作,通過JavaScript與Salesforce進行交互和我遇到一些問題,我一直沒能找出相當尚未。我的目標是拉動近期活動的歷史記錄,聯繫人,這樣我可以在我們的第三方應用程序展示自己的「行動」。我已經嘗試了一些不同的方法...... 使用顫振API,但這只是回報的應用程序「用戶」,而不是實際的「人脈」(這是我試圖讓) 我有數據也可用於variuos查詢的主機...如檢索Salesforce接觸活動歷史

var query = "SELECT (SELECT ActivityDate, Description, WhoId, Subject, OwnerId from ActivityHistories) FROM AccountFeed WHERE ParentId = '" + id + "'";

var query = "SELECT ID, CreatedDate, CreatedById, CreatedBy.FirstName, CreatedBy.LastName, ParentId, Parent.Name, (SELECT ID, FieldName, OldValue, NewValue FROM FeedTrackedChanges ORDER BY ID DESC) FROM UserProfileFeed WITH UserId = '" + id + "' ORDER BY CreatedDate DESC, Id DESC LIMIT 20"

任何指導,你們都可以提供將不勝感激! 謝謝!

回答

0

你可能爲了獲取ActivityHistory找到StackExchange for SalesForce有用的信息。但請注意,即使有這個鏈接,我也遇到了問題。

首先,你要確定什麼樣的,你所定位的系統用戶帳戶。在鏈接中,它是Account;對我而言,這是Contact。其次,系統可能對檢索這些信息有一些限制和約束。在我的情況下,例如,有2個約束:

  • 限制到500(MALFORMED_QUERY: There is an implementation restriction on ActivityHistories. When you query this relationship, security evaluation is implemented for users who don't have administrator permissions, and you must specify a LIMIT with a maximum of 500

  • 需要特定過濾器(MALFORMED_QUERY: There is an implementation restriction on ActivityHistories. When you query this relationship, security evaluation is implemented for users who don't have administrator permissions, and you must use a specific sort order: ActivityDate DESC, LastModifiedDate DESC

最後,這是我的查詢。

SELECT Name, (SELECT Subject,ActivityDate,ActivityType,ActivitySubtype,Description,Status FROM ActivityHistories ORDER BY ActivityDate DESC, LastModifiedDate DESC LIMIT 100) FROM Contact WHERE Id = 'abcde'