Configuring Real-Time Sync for the Number of Times Scheduled Field
The No of Times Scheduled field is not included in the Service Board packaged field set for ServiceMax release versions earlier than 23.1. To support real-time sync for this field for earlier release versions, you must complete additional manual configuration steps on the Salesforce side.
To support sync for this field, you first configure custom fields for the Work Order object for earlier release versions, and then enable the Enable Number of Times Scheduled Sync for Job setting for all versions.
Update logic for this field is implemented in a Before event handler for the Appointment object. If you previously configured a custom After event handler to reschedule Appointments, the Number of Times Scheduled value can be improperly incremented twice for a single rescheduled Appointment. In this case, you must also modify your custom event handler to avoid this issue.
To configure real-time sync for the Number of Times Scheduled field:
1. For release versions earlier than 23.1 only, follow the steps in Configuring Real-Time Sync to Support Custom Fields on SFDC to manually configure the custom field set for the Work Order object to add the No of Times Scheduled field, whose API name is SVMXC__NoOfTimesScheduled__c.
* 
For SVMXC/SB Salesforce package versions 23.1 and later, skip step 1.
2. For all release versions, in Max Designer, on the Administration () launchpad menu, click Settings, and then in the list view, click Enable Number of Times Scheduled Sync for Job.
3. On the record page, on the Overview tab, select the Default Value check box, and then in the top left corner, click Save and Close ().
4. Optionally, if you previously configured a custom After event handler to reschedule Appointments, update the logic related to your event handler to add SUPPRESS_JOB_SCHEDULED_NUM_UPDATE to putContextParameter as follows:
package com.servicemax.dc.custom

import org.joda.time.*
import com.servicemax.core.MaxObject
import com.servicemax.core.annotations.Application
import com.servicemax.core.event_handler.TemplateOperationEventHandler
import com.servicemax.dc.operation.appointment.UpdateJobScheduledNumber
import com.servicemax.core.Max

@Application(application='svmx_dispatch_console')
public class UpdateApptFieldEventHandler extends TemplateOperationEventHandler {

@Override
public Object realExecute(Map<String, Object> parameters) {
MaxObject record = affectedMaxObject
Max.executeInTransaction {
this.handleAppointmentUpdate(record)
}
}

private void handleAppointmentUpdate(MaxObject record) {
if (record.isFieldChanged('svmx_start_datetime')) {
def startTime = record.svmx_start_datetime.toDateTime(DateTimeZone.forID('Asia/Shanghai'))
if (startTime.getHourOfDay() < 9) {
Max.putContextParameter(UpdateJobScheduledNumber.SUPPRESS_JOB_SCHEDULED_NUM_UPDATE, true)
record.svmx_start_datetime = startTime.withHourOfDay(9)
record.svmx_end_datetime = record.svmx_start_datetime.plus(record.svmx_duration)
record.update()
}
}
}
}
For more information:
Was this helpful?