获取salesforce对象中的对象关联

获取salesforce对象中的对象关联,salesforce,Salesforce,我需要获取与salesforce用户关联的机会列表。但是我不知道用户对象和机会对象之间的关系 如何完成此操作?当您说“与salesforce用户关联的Opportunities”时,我假设您想要一个opportunity列表,其中salesforce所有者是opportunity记录的所有者。 您可以这样做: user u = [select id, name from user where id='put the user id here']; list<opportunity>

我需要获取与salesforce用户关联的机会列表。但是我不知道用户对象和机会对象之间的关系

如何完成此操作?

当您说“与salesforce用户关联的Opportunities”时,我假设您想要一个opportunity列表,其中salesforce所有者是opportunity记录的所有者。 您可以这样做:

user u = [select id, name from user where id='put the user id here'];
list<opportunity> listOfOpportunity = [select id, name from opportunity where ownerId=: u.Id];
user u=[选择id,用户的名称,其中id='将用户id放在这里'];
list listOfOpportunity=[从opportunity中选择id、名称,其中ownerId=:u.id];
用户可以通过其他方式与opportunity关联:createdBy和lastmodifiedBy。。此外,您还可以将自定义循环设置为用户对象


希望能有所帮助

是的,这只是一个疑问。。您可以打开开发人员控制台,转到查询编辑器,在编辑中仅粘贴查询并执行查询。您将看到结果