- Learning Salesforce Visual Workflow and Process Builder(Second Edition)
- Rakesh Gupta
- 146字
- 2021-07-09 20:57:32
Solution 1 - using an Apex trigger
Because this requirement means that many child records (opportunities) need to be updated when a parent record (Account) is edited, we can't achieve the preceding business requirement using the Workflow rule. The next possibility is to use an Apex trigger. Generally, a developer writes an Apex trigger on the Account object to update all the open opportunities when an account's custom field, out of business, gets updated to True. The following is the sample code:
trigger UpdateRelatedOpportunites on Account (after update) {
for (Account AccountToUpdate : trigger.new)
{
If (AccountToUpdate.Out_Of_Business__c==True)
{
// Your logic;
}
}
}
In addition, you'll need a test class and then use a change set, Force.com IDE or Force.com Migration Tool, to deploy the trigger and test classes to production. This also means that any change to the business logic will require more development work.
推薦閱讀
- Managing IaaS and DBaaS Clouds with Oracle Enterprise Manager Cloud Control 12c
- 國有企業經濟責任審計實務指南
- 注冊會計師全國統一考試專用教材:審計
- 大數據搜索與挖掘及可視化管理方案 :Elastic Stack 5:Elasticsearch、Logstash、Kibana、X-Pack、Beats (第3版)
- 審計實務案例與實訓教程
- 陜西國家統計調查專題研究集萃(2006—2015)
- 《企業內部控制基本規范》合規實務指南
- vSphere Design Best Practices
- PMP備考寶典:路晨帶你去通關
- Stata統計分析與行業應用案例詳解(第2版)
- 中國國內生產總值核算問題研究
- 多項目管理方法及其應用研究(國家社科基金后期資助項目)
- Windows Server 2016 Administration Fundamentals
- PMP 5A備考寶典
- 獨立審計質量的激勵治理模式研究