class - 错误: Compile Error: sObject type 'KnowledgeArticleVersion' is not supported.

标签 class error-handling apex-code

我在看起来不再存在的对象上遇到错误。尝试将不相关的Apex触发器部署到生产环境时,由于此错误,它不会让我失望。有人看过吗?您有什么建议吗?


public with sharing class KnowledgeArticleViewerController {
    public KnowledgeArticleVersion article {get; set;}
    private Id articleId;

    public KnowledgeArticleViewerController(ApexPages.standardController stdController) {
        articleId = ApexPages.currentPage().getParameters().get('id');

        List<KnowledgeArticleVersion> articles = [SELECT Id,Title FROM KnowledgeArticleVersion WHERE PublishStatus = 'Online'];

        ApexPages.addMessage( new ApexPages.Message(ApexPages.Severity.ERROR, 'Got article ids: ' + articles.get(0).Id 
         + ' ' + articles.get(1).Id + ' ' + articles.get(2).Id) );

        article = articles.get(0);

    }
}

结束码

Error: Compile Error: sObject type 'KnowledgeArticleVersion' 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 8 column 44



没有KnowledgeArticleVersion对象,并且在我到达这里之前2年以上实现了此代码。

最佳答案

每当您将任何代码更改部署到Salesforce的生产实例时,都会重新编译该实例的所有代码并运行所有测试。

您将必须通过删除对不存在的sObject(KnowledgeArticleVersion)的引用来修复此代码,然后才可以部署其他更改。

关于class - 错误: Compile Error: sObject type 'KnowledgeArticleVersion' is not supported.,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17415376/

相关文章:

swift - 调用私有(private) var 来方便 init (swift)

asp.net-mvc - ASP.NET MVC 应用程序自定义错误页面未显示在共享托管环境中

azure - 如何使用 Azure 数据库模拟暂时性错误?

salesforce - 使用 apex 可批处理代码时,在日志中看不到 system.debug 输出

salesforce - 文本区域上的换行符

Python 类@property : use setter but evade getter?

java - 与静态成员一起上课

salesforce - 检索 salesforce 实例 URL 而不是 Visualforce 实例

javascript - 自定义字符串类

ruby-on-rails - 在此 Controller /模型设置中如何显示错误?