• Damsos
  • NEWBIE
  • 10 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hello everyone !

I'm settling in this community as I've recently been given the task of implementing Salesforce for my company.

As I'm learning the ropes of administrating an Org I'm also getting interested in learning APEX.

So I've attempted to write simple triggers, which has worked out quite well until now.

Now, I'm attempting to trigger the creation of a Task whenever a Opportunity is created.

I want to link that task to that opportunity, to do just that I wanna use (api name) WhatID from the task fields.

Although I'm running into an error on that perticuliar line;;
 
trigger CadoSupere on Opportunity (after insert) {
    for (Opportunity opp : trigger.new) {
        Task t          = new Task();
        opp.WhatId      = opp.Id;
        opp.Description = 'Je vous offre un supere cado';
        insert t;
    }
}

Line 4: Variable does not exist

I've checked the field and it seems Field Lever Security is set to visible on that WhatId field.

Is there something obvious I'm missing ?

Thanks a bunch, have a nice day and I hope to help others when I get good :)
  • April 16, 2021
  • Like
  • 0
Hello everyone !

I'm settling in this community as I've recently been given the task of implementing Salesforce for my company.

As I'm learning the ropes of administrating an Org I'm also getting interested in learning APEX.

So I've attempted to write simple triggers, which has worked out quite well until now.

Now, I'm attempting to trigger the creation of a Task whenever a Opportunity is created.

I want to link that task to that opportunity, to do just that I wanna use (api name) WhatID from the task fields.

Although I'm running into an error on that perticuliar line;;
 
trigger CadoSupere on Opportunity (after insert) {
    for (Opportunity opp : trigger.new) {
        Task t          = new Task();
        opp.WhatId      = opp.Id;
        opp.Description = 'Je vous offre un supere cado';
        insert t;
    }
}

Line 4: Variable does not exist

I've checked the field and it seems Field Lever Security is set to visible on that WhatId field.

Is there something obvious I'm missing ?

Thanks a bunch, have a nice day and I hope to help others when I get good :)
  • April 16, 2021
  • Like
  • 0