Commerce Cloud

ServiceNow

How to place a Commerce Cloud order from a ServiceNow RITM or TASK, and write the response back to the ticket.

This scenario covers the end-to-end integration between ServiceNow and Commerce Cloud for automated IT procurement. The typical trigger is an approved RITM (Requested Item) or TASK, which your Flow or Business Rule converts into a Commerce Cloud order.


How it could work

The diagram below shows a high-level flow view from an approved ServiceNow request to receiving updates back in the ticket — using a Flow Designer flow with a REST step.

This is just an example to give you an idea of how you could design it in your ServiceNow instance.


Field mapping

The table below maps ServiceNow record fields to the Commerce Cloud order request.

Commerce Cloud fieldServiceNow sourceNotes
externalDocumentNumbersc_req_item.numberReturned on the invoice for reconciliation
typeStatic valueSet to "New" — For special needs, agree this with your account manager
invoice.idProvided by Danoffice ITA pre-registered invoice ID eliminates address errors
shipping.contact.emailsc_req_item.requested_for.emailUsed for delivery notifications
shipping.address*End user's location recordMap from cmn_location or user profile
orderLines[].itemNumberCatalogue item variableThe Danoffice IT item number agreed per catalogue item
orderLines[].quantitysc_cart_item.quantity
orderLines[].customerReferencetask.numberTies each line back to the source request

Example request

The following payload shows a typical ServiceNow-originated order where you include request number and task number(s).

{
  "externalDocumentNumber": "SN-ORD-00981",
  "type": "New",
  "invoice": {
    "id": "CUST1234",
    "vatNumber": "US123456789",
    "companyName": "Acme Corporation",
    "attentionName": "ServiceNow Procurement",
    "address1": "100 Main Street",
    "address2": null,
    "city": "San Jose",
    "zipCode": "95101",
    "stateName": "California",
    "countryIso2": "US"
  },
  "consignee": null,
  "sellTo": {
    "id": null,
    "companyName": "Acme Corporation",
    "contact": {
      "firstName": "Alice",
      "lastName": "Smith",
      "phoneNumber": "+14085550100",
      "email": "alice.smith@acme.com"
    },
    "address1": "100 Main Street",
    "address2": null,
    "city": "San Jose",
    "zipCode": "95101",
    "stateName": "California",
    "countryIso2": "US"
  },
  "shipping": {
    "companyName": "Acme Corporation",
    "contact": {
      "firstName": "Bob",
      "lastName": "Jones",
      "phoneNumber": "+14085550199",
      "email": "bob.jones@acme.com"
    },
    "address1": "200 Tech Park Drive",
    "address2": null,
    "city": "Santa Clara",
    "zipCode": "95054",
    "stateName": "California",
    "countryIso2": "US"
  },
  "orderLines": [
    {
      "itemNumber": "SN-LAPTOP-001",
      "quantity": 1.0,
      "customerReference": "TASK-LINE-1",
      "comments": null
    },
    {
      "itemNumber": "SN-DOCK-002",
      "quantity": 2.0,
      "customerReference": "TASK-LINE-2",
      "comments": null
    }
  ]
}

Writing the response back to ServiceNow

When the order is accepted, store the correlationId from the response on the ServiceNow record. This is your link between the ticket and every webhook event that follows.

A typical Business Rule or Flow Action would do something like:

// In a REST step's "Response" section
var correlationId = JSON.parse(response.body).data.correlationId;
current.u_cc_correlation_id = correlationId; // custom field on the RITM
current.update();

This field becomes the key for matching incoming webhook events — when Danoffice IT sends a shipping update, you look up the RITM by u_cc_correlation_id and update the ticket automatically.


Integration checklist

Before going live

  • Item numbers in your ServiceNow catalogue are agreed with your Danoffice IT account manager
  • Invoice ID or full invoice address has been confirmed
  • A custom field (e.g. u_cc_correlation_id) exists on the RITM or TASK to store the correlationId
  • Your webhook endpoint is configured and tested (only needed if you require live order updates) — see Events
  • Error responses (400, 401) are handled and surfaced in the ServiceNow ticket

On this page