• Maxim Petrosov
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
trigger ClosedOpportunityTrigger on Opportunity (after insert) {

    List<Task> taskListToInsert = new List<Task>();
    
    for(Opportunity opp:Trigger.new)
    {
       if(opp.StageName == 'CloseWon') 
       {
           Task t = new Task();
           t.Subject = 'Follow Up Test task';
           t.WhatId = opp.Id;
           taskListToInsert.add(t);
       }      
    }
    
    if(taskListToInsert.size() > 0)
       {
          insert taskListToInsert; 
       } 
}
When I'm trying ti invoke this trigger I have this error

There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Discount_Percent__c]: [Discount_Percent__c]
Can anyone help me with this?
trigger ClosedOpportunityTrigger on Opportunity (after insert) {

    List<Task> taskListToInsert = new List<Task>();
    
    for(Opportunity opp:Trigger.new)
    {
       if(opp.StageName == 'CloseWon') 
       {
           Task t = new Task();
           t.Subject = 'Follow Up Test task';
           t.WhatId = opp.Id;
           taskListToInsert.add(t);
       }      
    }
    
    if(taskListToInsert.size() > 0)
       {
          insert taskListToInsert; 
       } 
}
When I'm trying ti invoke this trigger I have this error

There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Discount_Percent__c]: [Discount_Percent__c]
Can anyone help me with this?