• shilpa smith
  • NEWBIE
  • 0 Points
  • Member since 2020

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

Does anybody know how to insert EventRelation records under Guest Site user after Summer 20 release?
I have the following code that is executed under "without sharing" permissions
List<Event> existingEvents = [SELECT WhatId, OwnerId, StartDateTime, EndDateTime, FROM Event WHERE Id = '00U1b000001fhBpEAI'];
existingEvents[0].StartDateTime = existingEvents[0].EndDateTime.addHours(-1);
update existingEvents[0];

insert new EventRelation(EventId = existingEvents[0].Id, RelationId = '00Q1b00000BsO5l', Status = 'New');
It gives me "Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_OR_READONLY, null: []"
 
03:38:15.0 (85981882)|SOQL_EXECUTE_BEGIN|[26]|Aggregations:0|SELECT WhatId, OwnerId, StartDateTime, EndDateTime FROM Event WHERE Id = '00U1b000001fhBpEAI'
03:38:15.0 (94621998)|SOQL_EXECUTE_END|[26]|Rows:1
03:38:15.0 (94854952)|VARIABLE_SCOPE_BEGIN|[26]|existingEvents|List<Event>|true|false
03:38:15.0 (94924847)|VARIABLE_ASSIGNMENT|[26]|existingEvents|[{"WhatId":"0061b000004eFxLAAU","OwnerId":"005360000017cKUAAY","StartDateTime":"2019-08-20T14:00:00.000Z","EndDateTime":"2019-08-20T14:30:00.000Z","Id":"00U1b000001fhBpEAI"}]|0x6b153f57
03:38:15.0 (94936602)|STATEMENT_EXECUTE|[27]
03:38:15.0 (95296873)|VARIABLE_ASSIGNMENT|[27]|this.StartDateTime|"2019-08-20T13:30:00.000Z"|0x4d3725de
03:38:15.0 (95306508)|STATEMENT_EXECUTE|[28]
03:38:15.0 (95372745)|DML_BEGIN|[28]|Op:Update|Type:Event|Rows:1
03:38:15.0 (95405572)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8
03:38:15.0 (687855591)|CODE_UNIT_STARTED|[EXTERNAL]|01q36000001Vtxg|Trigger_Event on Event trigger event AfterUpdate|__sfdc_trigger/Trigger_Event
......
03:38:15.0 (753602730)|VARIABLE_ASSIGNMENT|[29]|this.EventId|"00U1b000001fhBpEAI"|0x60e6adb4
03:38:15.0 (753684136)|VARIABLE_ASSIGNMENT|[29]|this.RelationId|"00Q1b00000BsO5lEAF"|0x60e6adb4
03:38:15.0 (753723876)|VARIABLE_ASSIGNMENT|[29]|this.Status|"New"|0x60e6adb4
03:38:15.0 (753798790)|DML_BEGIN|[29]|Op:Insert|Type:EventRelation|Rows:1
03:38:15.0 (804681249)|DML_END|[29]
03:38:15.0 (804839936)|EXCEPTION_THROWN|[29]|System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_OR_READONLY, null: []


 
  • July 30, 2020
  • Like
  • 0