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
Alekhya Mathukumilli 7Alekhya Mathukumilli 7 

code changes

Event insdtl                = new Event();
 private Inspection_Scheduling__c                 inspection;

 insdtl.RecordTypeId         = rt.Id;
        insdtl.Subject              = inspection.Inspection_Type__c +' - '+ inspection.Name;//rt.Name +' - '+ inspection.Name;
        insdtl.Preferred_Date__c    = inspection.Preferred_Date__c;
        insdtl.Alternate_Date__c    = inspection.Alternate_Date__c;
        insdtl.Date_Requested__c    = myDate;
        insdtl.OwnerId              = inspection.Inspector__c;
        insdtl.WhatId               = ins;
        insdtl.Contact_Email__c     = inspection.E_mail__c;
       insdtl.Inspection_Sch_Type__c = inspectionId;


       insdtl.TypePicklist_del__c = inspection.Type__c;

if(inspection.RecordTypeId==ComAdvrectypeid){
           //ins.RecordTypeId             = InspComAdv;
           //ins.License_Type_s__c       = inspection.License_Type_s__c; 
           insdtl.Violation_Number__c      = inspection.Violation_Number__c;
           insdtl.Previous_violation_s__c   = inspection.Previous_violations__c;
           //insdtl.Description__c           = inspection.Description__c;
           insdtl.On_Site_Interpretation__c= inspection.On_Site_Interpretation__c;
           insdtl.Preferred_Language__c    = inspection.Preferred_Language__c;
           //insdtl.Understands_disclaimer__c= inspection.Understands_disclaimer__c;
           insdtl.Additional_Language_s__c = inspection.Additional_Language_s__c;
           //insdtl.Consultation_Type__c     = inspection.Inspection_Type__c; 
           insdtl.Request_Topic_s__c       = inspection.Request_Topic_s__c;
           insdtl.Other_Topic_s__c         = inspection.Other_Topic_s__c; 
          
           system.debug('******************************in if*create event************************************') ;  
        }

I am trying to update a new field in already working code

insdtl.TypePicklist_del__c = inspection.Type__c;

by adding this like I want that picklist to be updated but the complete action of creating a record is not taking place.

Please suggest me why and how I can fix this.

Thank you,

Alekhya.

Eric PepinEric Pepin
If you need a new Event, then you will need to insert it like: insert insdtl;
If you need to update an existing Event, then you will need to specify the Event's Id, then update it like: update insdtl;