function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ivan sklyarov 2Ivan sklyarov 2 

how to create opportunity new Event ?

I want to save custom new Event object (like in opportunity -> activities). I haven't found any example. Would be great if someone will provide it

 
public with sharing class customOpportunityEvent {

    public Event event{get;set;}


    public customOpportunityEvent() {
        event = new Event();
    }

    public void fillConferenceInfo() {
        event.Subject = 'some Invitation';
        event.Location = 'location';
        event.Description = 'hi there';
    }

}

 
Ajay K DubediAjay K Dubedi
Hi Ivan,
What exactly is your requirement?
1. Do you want a related List on Opportunity with Events in it ?
2. You want to create new Event on creation of Opportunity ?

Thanks
Ajay
Ivan sklyarov 2Ivan sklyarov 2

I want to create new calendar event. but I've already found a solution

insert event;
Ajay K DubediAjay K Dubedi
Okay !! Great