updateEvent(updatedEvent, options)

Updates an event in the device’s calendar.

Using updateEvent() is an inherently dangerous action, as it allows event data to be irreversibly altered. Use caution when using this functionality in your component. At an absolute minimum, consider adding a confirmation window for your users that clearly states the outcome of the action, with an option for them to cancel if they wish.

Note

Syntax 

1import { getCalendarService } from 'lightning/mobileCapabilities';
2updateEvent(updatedEvent: Event,
3  options: CalendarServiceOptions
4  ): Promise<Object>

Parameters 

  • updatedEvent—(Required) An Event object with updated data to replace the existing data in the corresponding event on the device’s calendar.
  • options—(Required) A CalendarServiceOptions object to configure the CalendarService request.

Returns 

A Promise object that resolves as a coerced version of the Event parameter. If an error is encountered, an error message is returned.

Usage 

Use this function to update an event on a device’s calendar.

1myCalendarService
2  .updateEvent(updatedEvent, options)
3  .then((results) => {
4    this.updatedEvent = results;
5  })
6  .catch((error) => {
7    console.error("Error code: " + error.code);
8    +console.error("Error message: " + error.message);
9  });

For more information on when and why CalendarService coerces (changes) event data, see Implicit Data Coercion.

See Also

Release Preview

This release is in preview. Features described here don't become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can't guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.