Update ServiceMax Technical Attributes with a Salesforce Apex REST Data Destination
If you use the ServiceMax “Installed Products” object, you can use the TrueContext Salesforce Apex REST Data Destination A Data Destination specifies where to send data from a submitted form. You can use Data Destinations to automate data sharing and storage, routing data to a specific service (such as email or cloud storage) in several different formats. to update Technical Attributes.
Data Reference Expression Language (DREL) is used to get form data and metadata and add it to a string, such as dates, usernames, or answers to questions in forms. document in TrueContext.
Available on the Advanced and Enterprise tiers:
How Technical Attributes work
When a business manages different types of products, Technical Attributes provide a way to capture data specific to some—but not all—Installed Products. Technical Attributes might include, for example, ink levels in an ultrasound scanner printer or the helium level of an MRI scanner.
In ServiceMax, the “UpdateTechnicalAttributes” IoT Event updates Technical Attributes for an Installed Product by means of the Salesforce REST API. In TrueContext, the Salesforce Apex REST The Salesforce Apex REST is a type of Salesforce Data Destination that enables TrueContext to interact with Salesforce by means of an Apex REST API endpoint. If using an Apex REST API endpoint, developers can write APEX code to send custom messages that pull specific data from submitted forms. Data Destination invokes this event by
-
calling the appropriate REST endpoint URL, and
-
sending a DREL document that contains the JSON payload with all the values of the Technical Attributes.
In addition to the Salesforce REST API, you can also use the browser and ServiceMax mobile apps:
ServiceMax setup
Create the IoT Event in ServiceMax. Also, create a unique key that the TrueContext Data Destination will use to update Technical Attributes for the correct Installed Product record.
-
Sign in to ServiceMax as an Admin User, and then navigate to ServiceMax Setup > Connected Field Service> IoT Setup > IoT Events.
-
Add a row with the following entries, and then select Save:
-
Event Name: UpdateTechnicalAttributes
-
Class Name: UpdateTechnicalAttributes
Result: ServiceMax adds a new row to the IoT Events.
-
-
Configure an Installed Product Lookup
Lookup questions are options-based questions that "look up" the list of options from a Data Source. These include Dropdown, Radio Button, and Multiselect questions.:
ServiceMax Setup > Connected Field Service> IoT Setup > Installed Product Lookup.
-
Define and save the External Unique Key that you want TrueContext to use to uniquely identify the Installed Product. This can be a single field value or a combination of multiple field values.
Note:Add the entries in the same order as in the JSON payload configured in the DREL document (TrueContext setup, step 6).
The following example shows a combination of the serial/lot number and the “thing” identifier used in combination as the External Unique Key.
Result: This ensures that TrueContext updates the correct Installed Product record with Technical Attributes data.
-
Create a new Installed Product record or note the ID of an existing one.
TrueContext setup
-
Create the Salesforce Apex REST Data Destination:
Forms & Integrations > Data Destinations
A Data Destination specifies where to send data from a submitted form. You can use Data Destinations to automate data sharing and storage, routing data to a specific service (such as email or cloud storage) in several different formats. > Create Data Destination > Salesforce Apex REST
-
On the Connection tab, make sure that you select a connection to the correct ServiceMax org.
-
For the HTTP Method, select POST.
-
Keep the default Apex REST Prefix value /services/apexrest.
-
Enter the Apex REST Endpoint URL SVMXC/svmx/rest/IOTServiceIntf/IoT_Event_Name/2.0/
where IoT_Event_Name is the name from ServiceMax setup, step 2.
In this example, the endpoint is:
SVMXC/svmx/rest/IOTServiceIntf/UpdateTechnicalAttributes/2.0/
Info:The ServiceMax topic Update Technical Attributes provides the most up-to-date information about this endpoint.
-
Create a DREL document that contains the JSON payload required to update the Technical Attributes in ServiceMax.
-
Use DREL references to send submitted data from the form answers.
-
The
Other
attribute must include the External Unique Key of the Installed Product record that you want to update (from ServiceMax setup, step 4).
The following example shows the JSON required to:
-
Update the Asset product name with an answer from the submitted form.
-
Send submitted form data to update the Technical Attributes of the record that has the unique key defined in the “Others” section.
Tip:The values that start with
%a
get data for specific questions from the submitted form.
{ "Asset": { "SVMXC__Product_Name__c": "%a[ProductName]" }, "Event": { "instancePayload": { "Fields": [ { "title": "Specifications", "Description": "SectionDescription", "technicalAttributes": [ { "label": "Image Frequency", "type": "Static", "Sequence": 0, "defaultValue": "%a[ImageFrequency]", "Unit": "MHZ", "readOnly": "", "minNumber": "1", "maxNumber": "15", "format": "Number" }, { "label": "Operating Mode Used", "type": "Static", "Sequence": 1, "defaultValue": "%a[OperatingMode]", "Unit": "", "readOnly": "", "format": "Text" }, { "label": "Batteries Operational", "type": "", "sequence": 3, "defaultValue": "%a[Batteries]", "unit": "", "readOnly": "YES", "format": "Boolean" } ] } ] } }, "Others": { "SVMXC__Serial_Lot_Number__c": "%a[SerialNumber]", "Thing_Id__c": "%a[ThingId]" } }
-
-
Link the destination and document to a form:
Forms & Integrations > List Forms > FormName > Edit Form > Destinations
-
When a user submits the form and the destination executes successfully, ServiceMax creates
-
an entry in the IB Attributes Template Instance table, and
-
multiple entries in the IB Technical Attribute table, one for each attribute defined in the JSON payload.
Note:If Technical Attributes entries for the Installed Product record don’t exist, the Data Destination automatically creates them. Subsequent executions update the values.
Result: ServiceMax displays the Technical Attributes values for the Installed Product record, along with a history of previous values.
-