• Apks For Free
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
I'm wondering if this is just a glitch in Salesforce and if anyone has any workaround. I currently have a Trigger on ContentDocumentLink that sends an email to the owner of a custom object record when a File or Note is created and attached to that record. The trigger also attaches file information and the body of the Note if it's a ContentNote being inserted. The trigger handles the logic in differentiating Notes from other file types. The problem is when the user hits the button to create a new Note in classic or in the Console, an empty, untitled, new note record is inserted instantly firing my trigger before the user has time to add content to the body. In Lightning it at least allows the user to fill out the header of the note before saving, but saves before the note body is filled out. Cancelling out of creating the note still leaves the blank note saved and attached to the record. Any help in understanding why the note saves before the user hits the save button would be appreciated.
Hi - when doing the challenge "Bulk Apex Trigger" in Trailhead I get the error message :"Executing against the trigger does not work as expected."

I have checked the name of the class, task name as mentioned in the challenge description.

I have copied the code below :

trigger ClosedOpportunityTrigger on Opportunity (before insert, before update) {
  List<Task> taskList = new List<Task>();

    //If an opportunity is inserted or updated with a stage of 'Closed Won'
    // add a task created with the subject 'Follow Up Test Task'.
    for (Opportunity opp : [SELECT Id,Name FROM Opportunity
                     WHERE Id IN :Trigger.new AND StageName = 'Closed Won']) {
       //add a task with subject 'Follow Up Test Task'.
       taskList.add(new Task(Subject='Follow Up Test Task', WhatId = opp.id ));                
  }
                          
    if (taskList.size() > 0) {
        insert taskList;
    }



Thank you
Pierre-Alain