基本上,当“阶段”标记为“已关闭”时,“机会”中一个编号为“已关闭_成功__c”的数字字段应将其计数增加1。有人可以帮我提供代码吗
答案 0 :(得分:0)
您是说您是新来的。从Salesforce的Trailheads开始。它们非常适合开始使用SF的人们。
以下是有关触发器的模块链接: https://trailhead.salesforce.com/en/content/learn/modules/apex_triggers/apex_triggers_intro
尽管如此,我还是建议您从Apex Basics开始检查其他模块: https://trailhead.salesforce.com/content/learn/modules/apex_database
答案 1 :(得分:0)
这是该代码
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.
}
}
}