0

com 和顶点触发器

我有两个对象,即Customer_cOrder_c 我正在尝试编写一个触发器来删除属于已处于非活动状态的客户的订单条目。

基本上我想触发customer_c表的更新

从customer_c中检索一个条目,其中Active_c(布尔值)在更新时为假,并获取该客户的“名称”并在Order_c表中查找并删除属于该客户的所有“名称”(订单)。

下面是我的触发代码。当我试图将触发器保存在 salesforce 中时。我收到以下错误:

Error: Compile Error: unexpected token: 'res2' at line 13 column 19

有人可以帮我吗?

trigger NewCustomerActive on Customer__c(after update) {
  List<Customer__c> res2 = 
        [SELECT Name FROM Customer__c j WHERE j.Active__c = false];
  List<Order__c> res = 
        [SELECT Name FROM Order__c WHERE Customer__c = res2];
}
4

2 回答 2

1

将其更改为

trigger NewCustomerActive on Customer__c(after update) {
  List<Customer__c> res2 = 
        [SELECT Name FROM Customer__c j WHERE j.Active__c = false];
  List<Order__c> res = 
        [SELECT Name FROM Order__c WHERE Customer__c in:res2];
}
于 2013-04-09T09:22:50.567 回答
0

或者如果你想保存 soql 语句:

trigger NewCustomerActive on Customer__c(after update) {
  List<Order__c> res = 
        [SELECT Name FROM Order__c WHERE Customer__r.Active__c = false];
}
于 2013-04-10T14:48:42.930 回答