How to create Event using Apex in Salesforce?

Sample Code:

    Event E = new Event();
    E.Type = 'Email';
    E.Description = ''; //string
    E.OwnerId = ''; //user id
    E.WhatId = ''; //record id
     insert E;

1 comment:

  1. How do we populate Email and Phone fields on Event which are normally seen on UI but not in APEX?

    ReplyDelete