Updating an Installed Product Record in ServiceMax
A common use case is to perform simple updates in ServiceMax driven by events or property updates in ThingWorx. While this example is focused on updating installed product records, it can also be applied to any relevant ServiceMax object type.
Gather the following general information:
• The Salesforce "API name" of the ServiceMax object you wish to update.
• The ServiceMax business key or keys to uniquely identify the object.
Installed products have an API name of SVMXC__Installed_Product__c.
The unique business keys for installed products vary by customer. Commonly used fields include:
Salesforce Label (default)
|
API Field
|
Installed Product ID
|
Name
|
Product Name
|
SVMXC__Product_Name__c
|
Serial/Lot Number
|
SVMXC__Serial_Lot_Number__c
|
Asset Tag
|
SVMXC__Asset_Tag__c
|
Once you have determined your API object name and the field names of your business keys, you can use the following methods to perform an update:
• PTC.SCA.SCO.AssetService.ServiceMaxUtils FindIdByKeys: This service method assists by finding the Salesforce key (ID) of a Salesforce object using the business keys. This ensures that the Salesforce key is unique and fails if there is no record or more than one. It returns the Salesforce ID, which can then be used to update the record.
• PTC.SCA.SCO.AssetService.Connector.ServiceMaxConnector UpdateResources: This service is used to update objects in Salesforce. It can be called in many ways but for this situation, only the following parameters are needed:
◦ salesforceObjectType: The API name of the object to update.
◦ objects: Infotable of the data to be updated. This can be a partial set of fields, but must include the ID. The ID field is the primary key and is required for an update.
Examples:
The following complete example service methods using the previously mentioned methods can be found in PTC.SCA.SCO.AssetService.ServiceMaxUpdates:
• UpdateInstalledProductStatus
• UpdateInstalledProductStatusByModeISN
• UpdateInstalledProductStatusViaDataShape
Review the implementation of these methods to create your own similar methods as needed.