• Leo Chalvin
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
I recently started completing the 'Build Lightning Web Components' trail on Trailhead and as much as it is informational and pretty cool I am getting more and more confused about terminology. 

They refer to 'Lightning Web Components'... are these different from 'Lightning Components'? If so, how?

'Lightning Components' is just another term for 'Aura Components', right?

Finally, how do 'VisualForce Components' tie into all of this?
I have an Apex Trigger that has for main goal to set the 'Assigned To' (OwnerId) field depending on on the 'Related To' (WhatId) record's type.

I feel like I'm going a little bit crazy at this very instant because I could have sworn the trigger was working last week.

This is give or take what my code looks like currently:
trigger EventAssignToTrigger on Event (before insert) {
    for (Event e :Trigger.New) {
        String relatedObject = e.What.Type;
        
        if(e.What.Type == 'Account' || e.What.Type == 'Contract__c') {
            //related to Account, NDA Contract, or Vendor Contract
            if(e.What.Type == 'Account' || e.what.recordTypeId == '0121t000000EC3cAAG') {
                e.OwnerId = '0231w0000010AWx';  //Calendar 1
            } else if (e.what.recordTypeId == '0121t000000EC3mAAG') {
                e.OwnerId = '0231t000001EAwZ';  //Calendar 2
            }  else {
                e.OwnerId = '0231t000001EAwj'; //Calendar 3
            }
            
        }   
    }
}

The code above is slightly simplified but that is basically the just of it. For some reason I can't seem to access the 'What.Type' or 'What.RecordTypeId' from the trigger. Is that normal?
I know WhatId returns what it should but for some reason What.* returns null.
If this is normal, what are my options in terms of getting the WhatId object's type and record type?
I have an Apex Trigger that has for main goal to set the 'Assigned To' (OwnerId) field depending on on the 'Related To' (WhatId) record's type.

I feel like I'm going a little bit crazy at this very instant because I could have sworn the trigger was working last week.

This is give or take what my code looks like currently:
trigger EventAssignToTrigger on Event (before insert) {
    for (Event e :Trigger.New) {
        String relatedObject = e.What.Type;
        
        if(e.What.Type == 'Account' || e.What.Type == 'Contract__c') {
            //related to Account, NDA Contract, or Vendor Contract
            if(e.What.Type == 'Account' || e.what.recordTypeId == '0121t000000EC3cAAG') {
                e.OwnerId = '0231w0000010AWx';  //Calendar 1
            } else if (e.what.recordTypeId == '0121t000000EC3mAAG') {
                e.OwnerId = '0231t000001EAwZ';  //Calendar 2
            }  else {
                e.OwnerId = '0231t000001EAwj'; //Calendar 3
            }
            
        }   
    }
}

The code above is slightly simplified but that is basically the just of it. For some reason I can't seem to access the 'What.Type' or 'What.RecordTypeId' from the trigger. Is that normal?
I know WhatId returns what it should but for some reason What.* returns null.
If this is normal, what are my options in terms of getting the WhatId object's type and record type?