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
Uvais KomathUvais Komath 

How to insert UserServicePresence record via Apex?

  1. Tried with Apex : gets "DML Not supported error"
  2. Tried with Workbench REST Explorer gets following error :
CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY
message: entity type cannot be inserted: User Presence
errorCode: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

Any help is appreciated, Basically i am trying to build a lightning component for users to go offline from MOBILE
Tried both Javascript API and OmniChannelToolKit, Both does not work outside service console
Meghna Vijay 7Meghna Vijay 7
Hi, 
DML calls cannot be made by UserServicePresence. You can only use SOQL to get it's records but you can't change them.
Thanks
SFDC Prime SquadSFDC Prime Squad
Hi Uvais,
Only below operations are supported for UserServicePresence object:
delete(), query(), getDeleted(), getUpdated(), retrieve(), undelete()

More details on: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_userservicepresence.htm