在SalesForce中加入用户和登录历史记录?

在SalesForce中加入用户和登录历史记录?,salesforce,Salesforce,我无法从LoginHistory对象获取用户信息 我试过用这个 SELECT User.FirstName FROM LoginHistory 但它并没有说 INVALID_FIELD: SELECT User.FirstName FROM LoginHistory ^ ERROR at Row:1:Column:8 Didn't understand relationship 'User' in field path. If you are attempting to use a cust

我无法从LoginHistory对象获取用户信息

我试过用这个

SELECT User.FirstName FROM LoginHistory
但它并没有说

INVALID_FIELD: 
SELECT User.FirstName FROM LoginHistory
^
ERROR at Row:1:Column:8
Didn't understand relationship 'User' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
System.debug(JSON.serializePretty(LoginHistory.UserId.getDescripte())将“null”显示为“relationshipName”。并不是所有的关系都允许以这种方式“向上”,你可以查看我的答案中的一些例子

您需要处理两个单独的查询。因为相关列表也没有名称,所以同样没有办法撤销它。这行不通:

SELECT FirstName,
    (SELECT Id FROM LoginHistories LIMIT 10)
FROM User
LIMIT 10

也许有个主意你可以投票?也许你会有更多的运气。我没有亲自使用过它,但我的理解是它可以跟踪登录、注销、导出报告。。。可能更容易查询。

谢谢。也许我会处理两个问题。