salesforce - 我正在尝试在 Apex 中创建一个触发器,这有助于在阶段更新时增加计数
问题描述
基本上,当 Stage 被标记为 Closed Won 时,Opportunity 中标记为 Closed_Won__c 的数字字段应将其计数增加 1。有人可以帮我写代码吗
解决方案
这是代码
trigger ClosedOpportunityTrigger on Opportunity (after insert, after update) {
for(Opportunity opp : [SELECT Id,StageName FROM Opportunity Where Id IN :Trigger.New])
{
if(opp.StageName == 'Closed Won')
{
//add the code to increment the corresponding value here.
}
}
}
推荐阅读
- java - Rest api中的嵌套数组以连接字符串的形式出现
- mysql - select语句可以触发mysql中表的死锁吗?
- jquery - 使用jQuery将值从一个输入镜像到另一个输入
- postcss - 使用 .postcssrc 设置带有包裹的 postcss-url
- python - 如何检查特定的键和值是否也在字典中?
- python - 如何在我试图提取 Twitter 标签数据的 Python 代码中使用 Twitter API 中的“referenced_tweets.type”响应字段?
- charts - ChartJS:时间序列根本不渲染
- c++ - 使用 Windows GDI 渲染线弧折线
- ms-access - 永久更改缩放框的默认字体大小
- .net-core - 为什么所有 .NET Core 应用程序都是控制台应用程序?