2

ServiceAppointment is a Standard object when you enable Field Service settings. I used the below code in Java Script Button.

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")} 

var __sfdcSessionId = '{!GETSESSIONID()}';

var stc = new sforce.SObject('ServiceAppointment');
stc.id = '{!ServiceAppointment.Id}';
stc.Status= 'Arrived on site';
alert(stc);
var result = sforce.connection.update([stc]);
alert(result);
window.location.reload();

When I click on button its showing the below error but its working with Account object.

{errors:{message:'sObject type 'ServiceAppointment' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.', statusCode:'INVALID_TYPE', }, id:null, success:'false', }

1 Answer 1

3

ServiceAppointment object is available in API version 38.0 and later.

So, use

{!REQUIRESCRIPT("/soap/ajax/38.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/38.0/apex.js")} 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .