获取salesforce中打开的活动列表

时间:2013-02-13 09:24:41

标签: salesforce apex-code visualforce soql

我必须检索与自定义对象相关的OpenActivities列表为自定义对象启用了活动。获取列表我正在使用这样的查询

public List<OpenActivity> getActivity1(){

return [SELECT Subject from OpenActivities Where WhatId= :ApexPages.currentPage().getParameters().get('id') ];

}

当我保存它时,它给了我错误

Error: Compile Error: sObject type 'OpenActivities' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names. at line 44 column 8

任何人都可以告诉我如何检索salesforce中与特定记录对象相关的打开活动列表?

2 个答案:

答案 0 :(得分:3)

您应该使用此处描述的查询: http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_openactivity.htm

e.g。

List<Account> a = [SELECT (SELECT ActivityDate,
                                  Description,
                                  Subject
                           FROM OpenActivities)
                   FROM Account];

 for (Account a: l) {
     System.debug(a.OpenActivities);
 }

答案 1 :(得分:0)

正确答案是:

List<Account> a = [SELECT (SELECT ActivityDate,
                                  Description,
                                  Subject
                           FROM OpenActivities)
                   FROM Account];

 for (Account l: a) {
     System.debug(l.OpenActivities);
 }