Configuring Initial Sync for Actual Time Fields in Events
The Appointment object is configured with Actual Start Time and Actual End Time fields in Service Board. However, the corresponding fields are not configured for the Event and ServiceMax Event objects in Salesforce. If you have a business need to track scheduled versus actual times, you can add existing fields or custom fields to the Salesforce Event and ServiceMax Event objects to configure initial and real-time sync. In Salesforce, you can configure the Actual Start Time and Actual End Time fields for the Work Order, Event, or ServiceMax Event objects.
The procedure in this topic provides an example of how to use the fields in the following table to configure initial sync for the Event and ServiceMax Event objects.
Platform
|
Object
|
Field Name
|
API Name
|
Data Type
|
Salesforce
|
Event or ServiceMax Event
|
Actual Start
|
Actual_Start__c
|
Date/Time
|
Actual End
|
Actual_End__c
|
Service Board
|
Appointment
|
Actual Start
|
Actual_Start__c
|
|
Actual End
|
Actual_End__c
|
To configure initial sync for Actual Time fields in Events:
1. In Salesforce, follow the steps in
Configuring Real-Time Sync to Support Custom Fields on SFDC to add the
Actual Start (
Actual_Start__c) and
Actual End (
Actual_End__c) fields to the
Event or
ServiceMax Event object, and then to configure
ISCHANGED field-level filtering, do one of the following and save and close the record.
2. In
Max Designer, on the
Developer Tools (
) launchpad menu, click
Initial Sync Actions and open each of the following records, and then in the
Query URL field, add
Actual_Start__c and
Actual_End__c to the code as shown in the examples and save and close each record.
◦ Initial Sync UnClosed Work-Order Salesforce Events:
/services/data/@{SFDC_RESTAPI_VER}/query?q=select+Id,IsAllDayEvent,EndDateTime,Location,OwnerId,StartDateTime,Subject,SVMXC__Driving_Time_Home__c,SVMXC__Driving_Time__c,SVMXC__SM_Latitude__c,SVMXC__SM_Longitude__c,WhatId,Description,Actual_Start__c,Actual_End__c,SVMXSB__SM_Version_Number__c,CreatedById,CreatedDate,LastModifiedById,LastModifiedDate++FROM+Event+where+OwnerId+!=+null+and+StartDateTime+!=+null+and+EndDateTime+!=+null+and+Subject+!=+null+and+What.Type+=+'SVMXC__Service_Order__c'+and+WhatId++in+(select+id+from+SVMXC__Service_Order__c+where+Name+!=+null+and+SVMXC__Company__c+!=+null+and+SVMXC__Order_Status__c+=+'Open'+and+(SVMXC__Dispatch_Status__c+=+'New'+or+SVMXC__Dispatch_Status__c+=+'Assigned')+and+(SVMXC__SM_Integration_Source__c+=+null+or+SVMXC__SM_Integration_Source__c+=+'Local'))+and+(SVMXSB__SM_Integration_Source__c+=+null+or+SVMXSB__SM_Integration_Source__c+=+'Local')
◦ Initial Sync Closed Work-Order Salesforce Events:
/services/data/@{SFDC_RESTAPI_VER}/query?q=select+Id,IsAllDayEvent,EndDateTime,Location,OwnerId,StartDateTime,Subject,SVMXC__Driving_Time_Home__c,SVMXC__Driving_Time__c,SVMXC__SM_Latitude__c,SVMXC__SM_Longitude__c,WhatId,Description,Actual_Start__c,Actual_End__c,SVMXSB__SM_Version_Number__c,CreatedById,CreatedDate,LastModifiedById,LastModifiedDate+FROM+Event+where+OwnerId+!=+null+and+StartDateTime+!=+null+and+EndDateTime+!=+null+and+Subject+!=+null+and+What.Type+=+'SVMXC__Service_Order__c'+and+WhatId+in+(select+id+from+SVMXC__Service_Order__c+where+Name+!=+null+and+SVMXC__Company__c+!=+null+and+SVMXC__Order_Status__c+=+'Closed'+and+SVMXC__Dispatch_Status__c+=+'Assigned'+and+(SVMXC__SM_Integration_Source__c+=+null+or+SVMXC__SM_Integration_Source__c+=+'Local'))+and+(SVMXSB__SM_Integration_Source__c+=+null+or+SVMXSB__SM_Integration_Source__c+=+'Local')
◦ Initial Sync ServiceMax Events:
/services/data/@{SFDC_RESTAPI_VER}/query?q=select+id,OwnerId,SVMXC__IsAllDayEvent__c,SVMXC__SM_Appointment_Status__c,SVMXC__Technician__c,SVMXC__Driving_Time_Home__c,SVMXC__Driving_Time__c,SVMXC__EndDateTime__c,SVMXC__Location__c,SVMXC__SM_Latitude__c,SVMXC__SM_Longitude__c,Name,SVMXC__Service_Order__c,SVMXC__StartDateTime__c,SVMXC__Description__c,SVMXC__Service_Order__r.SVMXC__Dispatch_Status__c,SVMXC__Service_Order__r.SVMXC__Order_Status__c,Actual_Start__c,Actual_End__c,SVMXC__SM_Version_Number__c,CreatedById,CreatedDate,LastModifiedById,LastModifiedDate+from+SVMXC__SVMX_Event__c+where+OwnerId+!=+null+and+SVMXC__Service_Order__c+in+(select+id+from+SVMXC__Service_Order__c+where+Name+!=+null+and+SVMXC__Company__c+!=+null+and+(SVMXC__Order_Status__c+=+'Open'+or+SVMXC__Order_Status__c+=+'Closed')+and+(SVMXC__Dispatch_Status__c+=+'New'+or+SVMXC__Dispatch_Status__c+=+'Assigned')+and+(SVMXC__SM_Integration_Source__c+=+null+or+SVMXC__SM_Integration_Source__c+=+'Local'))+and+SVMXC__Technician__c+!=+null+and+SVMXC__StartDateTime__c+!=+null+and+SVMXC__EndDateTime__c+!=+null+and+SVMXC__DurationInMinutes__c+%3E+0+and+(SVMXC__SM_Integration_Source__c+=+null+or+SVMXC__SM_Integration_Source__c+=+'Local')
3. In
Max Designer, on the
Developer Tools (
) launchpad menu, click
Transform Templates and open the
SFE Initial Sync Template and
Closed SFE Initial Sync Template records, and then in the
Custom Field Mappings field for each record, add the following code and save and close the record.
◦ If the Actual Start Time and Actual End Time fields on Salesforce are configured to include travel time to and from Events:
"svmx_actual_start_time": "ifelse(IsAllDayEvent, isoDateFormat(Actual_Start__c), dateAddSubtractFormat(Actual_Start__c, SVMXC__Driving_Time__c))",
"svmx_actual_end_time": "ifelse(IsAllDayEvent, isoDateFormat(Actual_End__c), dateAddSubtractFormat(Actual_End__c, SVMXC__Driving_Time_Home__c, false))",
◦ Otherwise:
"svmx_actual_start_time": "isoDateFormat(Actual_Start__c)",
"svmx_actual_end_time": "isoDateFormat(Actual_End__c)",
4. In the Transform Templates list view, open the SME Initial Sync Template record, and then in the Custom Field Mappings field, add the following code and save and close the record.
◦ If the Actual Start Time and Actual End Time fields on Salesforce are configured to include travel time to and from Events:
"svmx_actual_start_time": "ifelse(SVMXC__IsAllDayEvent__c, isoDateFormat(Actual_Start__c), dateAddSubtractFormat(Actual_Start__c, SVMXC__Driving_Time__c))",
"svmx_actual_end_time": "ifelse(SVMXC__IsAllDayEvent__c, isoDateFormat(Actual_End__c), dateAddSubtractFormat(Actual_End__c, SVMXC__Driving_Time_Home__c, false))",
◦ Otherwise:
"svmx_actual_start_time": "isoDateFormat(Actual_Start__c)",
"svmx_actual_end_time": "isoDateFormat(Actual_End__c)",
For more information: