Virtual Attribute Implementation Examples

This topic provides script examples to show how virtual attributes can flatten, format, and enhance payloads.

The following ImpEx is for a CustomerReview Integration Object that contains the virtual attributes productRating, productName, and createdOnDate:

Each of the following script examples backs a specific virtual attribute referenced in the above ImpEx.

Payload Flattening

This example shows a script called formatProductName that backs the virtual attribute productName that flattens a payload.

Payload Formatting

This example shows a script called formatStars that backs the virtual attribute ProductRating that formats a product review rating to stars.

Payload Enhancement

This example shows a script called formatDate that backs the virtual attribute createdOnDate that formats a date so that it's in human-readable format.