Salesforce 在父级运行逻辑时更新孩子的子级



嗨,我有以下代码,我从孩子那里获取ID,然后在父母中查找相同的代码。然后,当我的状况通过时,我想更新我的孩子的孩子

我的代码:

list<Stripe_Customer__c> Clist = new list<Stripe_Customer__c> 
                                                ([Select Id, Distributor__c, FBO_Name__c, FLP_Email__c, Language_Preference__c,
                                                (select Id from Stripe_Invoices__r where Attempt_Count__c = 1 
                                                                AND Paid__c = false
                                                                AND Missed_Payment_Email1__c = FALSE
                                                                AND Invoice_Date__c = TODAY AND Live_Mode__c = TRUE 
                                                                AND Attempted__c = TRUE limit 1) 
                                                                from Stripe_Customer__C
                                                where Id IN (select Stripe_Customer__c from Stripe_Invoice__c 
                                                                where Attempt_Count__c= 1
                                                AND Paid__c = false 
                                                AND Invoice_Date__c = TODAY
                                                AND Live_Mode__c = TRUE 
                                                AND Attempted__c = TRUE
                                                AND Missed_Payment_Email1__c = FALSE)]);
        for(Stripe_Customer__c cid : Clist){
            Dlist.add(cid.Distributor__c);
        }
        List<account> Alist = new List<account>([ SELECT name, Email_FLP_com__c, Language_Preference__c ,
                                                 (select Distributor__c from Stripe_Customers__r where Provision_Status__c='active')
                                                 from account where Distributor_ID__c IN: Dlist]);

for(account c:clist({

//我的代码}

c=Stripe_Customer__c;
{
c.Stripe_Invoices__r[0].Missed_Payment_Email1__c = true;
            c.Stripe_Invoices__r[0].Missed_Email1_Date__c = system.today();
            c.Stripe_Invoices__r[0].Email_Response__c = resultBodyGet;
            InUpdate.add(c.Stripe_Invoices__r[0]);
}
update InUpdate;

现在想更新列表inupdate = new List((;带有帐户的查找和孩子的stripe_customer __c

请帮助

当您调用'update inupdate''的'euppt inupdate'时,您已经在执行此类更新 - 只需确保查询'Clist中所需的所有字段'并进行更改。

除了立即弹出的内容外,您不能在帐户循环中循环" clist",因为这些是不同的对象。同样,正如现在所写的那样,看起来您正在以for循环进行更新,这是一个不好的做法,您应该避免这样做。您应该检查有关批量代码的开发人员指南。

最新更新