|
|
The Transform Operation field in the Transform Template object is overwritten whenever release versions are upgraded. Because any updates to this field value are not preserved at upgrade, you must create a custom transform template to execute the custom transform operation.
|
/*
* Copyright (C) 2007-present, ServiceMax Inc.
*
* The program(s) herein may be used and/or copied only with
* the written permission of ServiceMax Inc. or in accordance with
* the terms and conditions stipulated in the agreement/contract
* under which the program(s) have been supplied.
*/
package com.servicemax.dc.operation.integration
import com.servicemax.core.Database
import com.servicemax.core.Max
import com.servicemax.core.annotations.Application
import com.servicemax.transform.operation.TransformOperation
@Application(application = 'svmx_dispatch_console')
class SyncAppointmentCreateOperation extends TransformOperation {
@Override
protected Object realExecute(Map<String, Object> parameters) throws Exception {
SyncOperationHelper.validateParameters(parameters)
def result = [success: true]
Collection<Object> convertedRecords = parameters.get('records')
Map record = (Map) convertedRecords.iterator().next()
String externalId = record.get('io_external_id')
if (!isExistedInSB(externalId)) {
executePatch('svmx_appointment', convertedRecords, null)
}
return result
}
private boolean isExistedInSB(String externalId) {
Max.executeInTransaction {
Integer size = Database.queryObject('SELECT count(*) FROM svmx_appointment WHERE io_external_id = :io_external_id', [io_external_id: externalId])
return size > 0
}
}
}

|
Field
|
Value
|
|---|---|
|
Name
|
Sync Appointment Create Event
|
|
Identifier
|
sync_appointment_create_event |
|
Computer Language
|
Groovy
|
|
Class Name
|
com.servicemax.dc.operation.integration.SyncAppointmentCreateOperation |
|
Method Name
|
execute |


|
Field
|
Value
|
|---|---|
|
Name
|
SFE to Appointment Create Custom Template |
|
Identifier
|
salesforce_event_svmx_appointment_create_custom |
|
Transform Operation
|
Sync Appointment Create Event
|
|
Field
|
Value
|
|---|---|
|
Name
|
SFDC Real-Time Sync Custom Transform Rules
|
|
Applicable Application
|
Service Board
|
|
Identifier
|
sfdc_realtime_sync_custom_transform_rules |
|
Datatype
|
Code |
|
Default Value
|
{
|
|
Application
|
Service Board
|