EntityView Sample – Order Preview

Version: 10.3

Properties added, provided by the Orders plugin:

RequestResponse
OrderConfirmationId<=order.OrderConfirmationId
OrderPlacedDate<=order.OrderPlacedDate
Status<=order.Status
PaymentStatus<=order.PaymentStatus
ShopName<=order.ShopName
CustomerEmail<=order.GetComponent<ContactComponent>().Email
OrderTotal<=order.Totals.GrandTotal

Sample call to retrieve EntityView:

RequestResponse
http://{{ServiceHost}}/{{ShopsApi}}/GetEntityView()

Body:

RequestResponse
{
    "entityId":"{006fa25e-d3ca-4e05-97fb-55afd8568e2e}",
    "viewName":"Preview",
    "forAction":""
}

Sample results from the call:

RequestResponse
{
  "@odata.context": "http://localhost:5000/Api/$metadata#Sitecore.Commerce.EntityViews.EntityView",
  "@odata.type": "#Sitecore.Commerce.EntityViews.EntityView",
  "Name": "Preview",
  "Policies": [],
  "DisplayName": "Preview",
  "EntityId": "{006fa25e-d3ca-4e05-97fb-55afd8568e2e}",
  "Action": "",
  "ItemId": "",
  "Properties": [
    {
      "Name": "OrderConfirmationId",
      "Policies": [],
      "DisplayName": "Order Confirmation Id",
      "Value": "{006fa25e-d3ca-4e05-97fb-55afd8568e2e}",
      "IsHidden": false,
      "OriginalType": "String",
      "IsReadOnly": false,
      "UiType": ""
    },
    {
      "Name": "OrderPlacedDate",
      "Policies": [],
      "DisplayName": "Placed Date",
      "Value": "8/19/2016 9:52:02 PM",
      "IsHidden": false,
      "OriginalType": "DateTime",
      "IsReadOnly": false,
      "UiType": ""
    },
    {
      "Name": "Status",
      "Policies": [],
      "DisplayName": "Status",
      "Value": "Completed",
      "IsHidden": false,
      "OriginalType": "String",
      "IsReadOnly": false,
      "UiType": ""
    },
    {
      "Name": "PaymentStatus",
      "Policies": [],
      "DisplayName": "Payment Status",
      "Value": "Paid",
      "IsHidden": false,
      "OriginalType": "String",
      "IsReadOnly": false,
      "UiType": ""
    },
    {
      "Name": "ShopName",
      "Policies": [],
      "DisplayName": "Shop Name",
      "Value": "Storefront",
      "IsHidden": false,
      "OriginalType": "String",
      "IsReadOnly": false,
      "UiType": ""
    },
    {
      "Name": "OrderTotal",
      "Policies": [],
      "DisplayName": "Order Total",
      "Value": "USD1,034.00",
      "IsHidden": false,
      "OriginalType": "Money",
      "IsReadOnly": false,
      "UiType": ""
    },
    {
      "Name": "CustomerEmail",
      "Policies": [],
      "DisplayName": "Customer Email",
      "Value": "[email protected]",
      "IsHidden": false,
      "OriginalType": "String",
      "IsReadOnly": false,
      "UiType": ""
    }
  ],
  "ChildViews": [],
  "DisplayRank": 500,
  "UiHint": "Flat"
}

Do you have some feedback for us?

If you have suggestions for improving this article,