Get RMA Labels (After)

This action occurs after an RMA label is retrieved. Changes made to the RMA label in this action persist in Kibo.

Action TypeEmbedded
Full Action IDembedded.commerce.return.GetRmaLabels.after
Runs multiple custom functions?Yes

JavaScript File Structure

Action files share the following basic structure:

module.exports = function(context, callback) {
   // Your custom code here
   callback();
};

When you code the custom function for an action, you have access to two arguments:

callback—This argument follows the established JavaScript callback pattern: it takes an error as the first argument (or null if there is no error) and a result as the second argument (if required).

context—This argument provides the function access to relevant objects and methods that interface with Kibo.

Context: Return

The following methods and objects are available to this action through the use of the context argument.

Microservice Operation
This action corresponds to the microservice that creates RMA labels.

Get Methods

Exec Methods

Context Objects Available to All Actions

Get

get.getShipmentInfo

Retrieves shipment information for the return.

ParametersTypeDescription
N/AN/AN/A

Example:

context.get.getShipmentInfo();

Response:

{
   "auditInfo": {
      "createBy": "string",
      "createDate": "DateTime",
      "updateBy": "string",
      "updateDate": "DateTime"
   },
   "cost": "decimal",
   "currencyCode": "string",
   "destinationAddress": {
      "address": {
         "address1": "string",
         "address2": "string",
         "address3": "string",
         "address4": "string",
         "addressType": "string",
         "cityOrTown": "string",
         "countryCode": "string",
         "isValidated": "bool",
         "postalOrZipCode": "string",
         "stateOrProvince": "string"
      },
      "companyOrOrganization": "string",
      "email": "string",
      "firstName": "string",
      "id": "int",
      "lastNameOrSurname": "string",
      "middleNameOrInitial": "string",
      "phoneNumbers": {
         "home": "string",
         "mobile": "string",
         "work": "string"
      }
   },
   "id": "string",
   "originAddress": {
      "address": {
         "address1": "string",
         "address2": "string",
         "address3": "string",
         "address4": "string",
         "addressType": "string",
         "cityOrTown": "string",
         "countryCode": "string",
         "isValidated": "bool",
         "postalOrZipCode": "string",
         "stateOrProvince": "string"
      },
      "companyOrOrganization": "string",
      "email": "string",
      "firstName": "string",
      "id": "int",
      "lastNameOrSurname": "string",
      "middleNameOrInitial": "string",
      "phoneNumbers": {
         "home": "string",
         "mobile": "string",
         "work": "string"
      }
   },
   "packageIds": "string",
   "shippingMethodCode": "string",
   "signatureRequired": "bool",
   "trackingNumber": "string"
}

For information about the properties in the response, refer to the REST API Help.

get.getPackage

Retrieves a specific package.

ParametersTypeDescription
indexnumberThe package index (based on the number of packages in the return).

Example:

context.get.getPackage(2);

Response:

{
   "auditInfo": {
      "createBy": "string",
      "createDate": "DateTime",
      "updateBy": "string",
      "updateDate": "DateTime"
   },
   "availableActions": "string",
   "changeMessages": [
      {
         "amount": "decimal",
         "appId": "string",
         "appKey": "string",
         "appName": "string",
         "correlationId": "string",
         "createDate": "DateTime",
         "id": "string",
         "identifier": "string",
         "message": "string",
         "metadata": "object",
         "newValue": "string",
         "oldValue": "string",
         "subject": "string",
         "subjectType": "string",
         "success": "bool",
         "userFirstName": "string",
         "userId": "string",
         "userLastName": "string",
         "userScopeType": "string",
         "verb": "string"
      }
   ],
   "code": "string",
   "fulfillmentDate": "DateTime",
   "fulfillmentLocationCode": "string",
   "hasLabel": "bool",
   "id": "string",
   "items": [
      {
         "fulfillmentItemType": "string",
         "lineId": "int",
         "optionAttributeFQN": "string",
         "productCode": "string",
         "quantity": "int"
      }
   ],
   "measurements": {
      "height": {
         "unit": "string",
         "value": "decimal"
      },
      "length": {
         "unit": "string",
         "value": "decimal"
      },
      "weight": {
         "unit": "string",
         "value": "decimal"
      },
      "width": {
         "unit": "string",
         "value": "decimal"
      }
   },
   "packagingType": "string",
   "shipmentId": "string",
   "shippingMethodCode": "string",
   "shippingMethodName": "string",
   "status": "string",
   "trackingNumber": "string"
}

For information about the properties in the response, refer to the REST API Help.

get.getPackagesCount

Returns the total number of packages associated with the return.

ParametersTypeDescription
N/AN/AN/A

Example:

context.get.getPackage(2);

Response: A number indicating the total number of packages.

Exec

exec.setDestinationAddress

Sets the destination address for the RMA label.

ParametersTypeDescription
destinationAddressContactobjectAn address object.

Example:

context.exec.setDestinationAddress(Address);

Response:

{
   "auditInfo": {
      "createBy": "string",
      "createDate": "DateTime",
      "updateBy": "string",
      "updateDate": "DateTime"
   },
   "cost": "decimal",
   "currencyCode": "string",
   "destinationAddress": {
      "address": {
         "address1": "string",
         "address2": "string",
         "address3": "string",
         "address4": "string",
         "addressType": "string",
         "cityOrTown": "string",
         "countryCode": "string",
         "isValidated": "bool",
         "postalOrZipCode": "string",
         "stateOrProvince": "string"
      },
      "companyOrOrganization": "string",
      "email": "string",
      "firstName": "string",
      "id": "int",
      "lastNameOrSurname": "string",
      "middleNameOrInitial": "string",
      "phoneNumbers": {
         "home": "string",
         "mobile": "string",
         "work": "string"
      }
   },
   "id": "string",
   "originAddress": {
      "address": {
         "address1": "string",
         "address2": "string",
         "address3": "string",
         "address4": "string",
         "addressType": "string",
         "cityOrTown": "string",
         "countryCode": "string",
         "isValidated": "bool",
         "postalOrZipCode": "string",
         "stateOrProvince": "string"
      },
      "companyOrOrganization": "string",
      "email": "string",
      "firstName": "string",
      "id": "int",
      "lastNameOrSurname": "string",
      "middleNameOrInitial": "string",
      "phoneNumbers": {
         "home": "string",
         "mobile": "string",
         "work": "string"
      }
   },
   "packageIds": "string",
   "shippingMethodCode": "string",
   "signatureRequired": "bool",
   "trackingNumber": "string"
}

For information about the properties in the response, refer to the REST API Help.

exec.setOriginAddress

Sets the origin address for the RMA label.

ParametersTypeDescription
originAddressContactobjectAn address object.

Example:

context.exec.setDestinationAddress(Address);

Response:

{
   "auditInfo": {
      "createBy": "string",
      "createDate": "DateTime",
      "updateBy": "string",
      "updateDate": "DateTime"
   },
   "cost": "decimal",
   "currencyCode": "string",
   "destinationAddress": {
      "address": {
         "address1": "string",
         "address2": "string",
         "address3": "string",
         "address4": "string",
         "addressType": "string",
         "cityOrTown": "string",
         "countryCode": "string",
         "isValidated": "bool",
         "postalOrZipCode": "string",
         "stateOrProvince": "string"
      },
      "companyOrOrganization": "string",
      "email": "string",
      "firstName": "string",
      "id": "int",
      "lastNameOrSurname": "string",
      "middleNameOrInitial": "string",
      "phoneNumbers": {
         "home": "string",
         "mobile": "string",
         "work": "string"
      }
   },
   "id": "string",
   "originAddress": {
      "address": {
         "address1": "string",
         "address2": "string",
         "address3": "string",
         "address4": "string",
         "addressType": "string",
         "cityOrTown": "string",
         "countryCode": "string",
         "isValidated": "bool",
         "postalOrZipCode": "string",
         "stateOrProvince": "string"
      },
      "companyOrOrganization": "string",
      "email": "string",
      "firstName": "string",
      "id": "int",
      "lastNameOrSurname": "string",
      "middleNameOrInitial": "string",
      "phoneNumbers": {
         "home": "string",
         "mobile": "string",
         "work": "string"
      }
   },
   "packageIds": "string",
   "shippingMethodCode": "string",
   "signatureRequired": "bool",
   "trackingNumber": "string"
}

For information about the properties in the response, refer to the REST API Help.

exec.setShippingMethodCode

Sets the shipping method for the RMA label.

ParametersTypeDescription
shippingMethodCodestringThe unique identifier of the shipping method.

Example:

context.exec.setDestinationAddress(Address);

Response:

{
   "auditInfo": {
      "createBy": "string",
      "createDate": "DateTime",
      "updateBy": "string",
      "updateDate": "DateTime"
   },
   "cost": "decimal",
   "currencyCode": "string",
   "destinationAddress": {
      "address": {
         "address1": "string",
         "address2": "string",
         "address3": "string",
         "address4": "string",
         "addressType": "string",
         "cityOrTown": "string",
         "countryCode": "string",
         "isValidated": "bool",
         "postalOrZipCode": "string",
         "stateOrProvince": "string"
      },
      "companyOrOrganization": "string",
      "email": "string",
      "firstName": "string",
      "id": "int",
      "lastNameOrSurname": "string",
      "middleNameOrInitial": "string",
      "phoneNumbers": {
         "home": "string",
         "mobile": "string",
         "work": "string"
      }
   },
   "id": "string",
   "originAddress": {
      "address": {
         "address1": "string",
         "address2": "string",
         "address3": "string",
         "address4": "string",
         "addressType": "string",
         "cityOrTown": "string",
         "countryCode": "string",
         "isValidated": "bool",
         "postalOrZipCode": "string",
         "stateOrProvince": "string"
      },
      "companyOrOrganization": "string",
      "email": "string",
      "firstName": "string",
      "id": "int",
      "lastNameOrSurname": "string",
      "middleNameOrInitial": "string",
      "phoneNumbers": {
         "home": "string",
         "mobile": "string",
         "work": "string"
      }
   },
   "packageIds": "string",
   "shippingMethodCode": "string",
   "signatureRequired": "bool",
   "trackingNumber": "string"
}

For information about the properties in the response, refer to the REST API Help.

Context Objects Available to All Actions

apiContext

Accesses tenant information.

PropertiesTypeDescription
baseUrlstringThe base URL for the site.
basePciUrlstringThe base PCI URL for the site.
tenantPodstringThe name of the tenant pod in which the tenant resides.
appClaimsstringThe application claims token.
appKeystringThe application key.
tenantIdintegerUnique identifier for the tenant.
siteIdintegerUnique identifier for the site. This ID is used at all levels of a store, catalog, and tenant to associate objects to a site.
masterCatalogIdintegerUnique identifier for the master catalog.
catalogIdintegerThe unique identifier for the product catalog. Catalogs are part of a master catalog.
currencyCodestringThe default three-letter ISO currency code for monetary amounts.
previewDatedate/timeThe date and time that the content is being viewed. This might be a future date if the content is previewed with an active date range set in the future.
localeCodestringThe locale code per the country code provided. This code determines the localized content to use and display.
correlationIdstringThe unique identifier of the API request associated with the event action, which might contain multiple actions.
isAuthorizedAsAdminBooleanIndicates whether the Dev Account user is authorized as an admin.
userClaimsstringThe user claims token.

Example:

context.apiContext.baseUrl;