• Jhonny Alexander Ramirez Chiroque 4
  • NEWBIE
  • 5 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Easy challenge, copying the code of CloudNewsTrigger and including small changes, but I have stucked with the UserId.

Using this code for OrderEventTrigger you will pass the course:
 
trigger OrderEventTrigger on Order_Event__e (after insert) {    
    // List to hold all tasks to be created.
    List<Task> tasks = new List<Task>();
    
    // Get queue Id for task owner
    //Group queue = [SELECT Id FROM Group WHERE Name='Regional Dispatch' LIMIT 1];
     String usr = UserInfo.getUserId();  
    // Iterate through each notification.
    for (Order_Event__e event : Trigger.New) {
        if (event.Has_Shipped__c == true) {
            // Create Task to dispatch new team.
            Task ts = new Task();
            ts.Priority = 'Medium';
            ts.Status = 'New';
            ts.Subject = 'Follow up on shipped order ' + event.Order_Number__c;
            ts.OwnerId = usr;//queue.Id;
            tasks.add(ts);
        }
   }
    
    // Insert all tasks corresponding to events received.
    insert tasks;

}

Good luck!

Hi,

 

Can anyone please let me know why is this checkbox 'Starts with a vowel sound' is used while creating objects in salesforce?

 

I read somewhere that 'This is used for languages where words need different treatment depending on the first character'.

 

If anyone can explain me with example on how it works that would be great.

 

Thanks in advance

Priya Nair

  • April 26, 2010
  • Like
  • 0