Back to Website
Show / Hide Table of Contents

export-to-ecommerce

  • Last updated on December 29, 2023
  • •
  • 3 minutes to read

This task attaches data to an order in an e-commerce system based on which the project was created.

Parameters

  • dataItemKey (string) - The key defining the parameter name in the order metadata.
  • dataItemValue (string) - The value to be written to the parameter.
  • dataItemType (string) - The data type to be written, one of plainText | commaSeparatedList | json.

PlainText

One of the purposes of attaching data to an order is to visualize the processing results of the corresponding parameter in BackOffice. To do so, you can create a multi-line description with explicit links for downloads. Similar to send-email, when we compose the message body and use the placeholder to indicate where the link block should be inserted, here, the link block is built based on a template that can be customized.

To configure the placeholder, use the following parameters:

  • plainTextLinksPlaceholder (string) - A marker for inserting the prepared list of download links for all artifacts passed to the task. The specified sequence is searched in dataItemValue and is replaced with the block of links. The default marker is "$$links$$".

    Example 1: "dataItemValue": "Greetings {{project.customerName}}. <br> You can download the print file for your personalized product here: <br>$$links$$ <br>"

  • plainTextLinksItemTemplate (string) - The template describing a single line from the list of links. The template supports markers for the artifact file link (plainTextLinksItemUrlPlaceholder) and the artifact name (plainTextLinksItemNamePlaceholder).

    Example 1: "plainTextLinksItemTemplate" : "<span>&bull; <a href=\"$$url$$\">$$name$$</a></span><br>"

    Example 2: "plainTextLinksItemTemplate" : "Link to download file $$name$$: $$url$$\"

  • plainTextLinksItemUrlPlaceholder (string) - The marker for inserting the link; only works within plainTextLinksItemTemplate. The default marker is "$$url$$".

  • plainTextLinksItemNamePlaceholder (string) - The marker for inserting the name; only works within plainTextLinksItemTemplate. The default marker is "$$name$$".

CommaSeparatedList

If you want to attach links for additional processing on the side of the integration plugin, then you are better off passing it as a list.

To build a list of artifacts, use the interpolation placeholder "{{result:url}}", where result is the artifact name from the inputArtifacts list. If you need to display a list, use "{{results*:url}}". In this case, the results will be the name of the artifact collection, and the links will be written in one line separated by commas.

Json

In some cases, we need to pass data to the order, which will be retrieved by the client's system. To do so, you can write data in the JSON format and use interpolation. For example, the interpolation ["{{result*:url:list-json}}"] will generate a JSON collection of strings separated by commas. Similarly, ["{{result*:list-json}}"] can be used to obtain a list of identifiers.

These parameters support argument interpolation following the common rules.

Examples

PlainText

{
    "description": "Attach artifacts to order in ecommerce",
    "name": "attach-data-to-order",
    "type": "export-to-ecommerce",
    "inputArtifacts": [
        "rendered-design*"
    ],
    "parameters": {
        "dataItemType" : "plainText",
        "dataItemKey" : "results",
        "dataItemValue": "You can download project {{project.id}} processing results here: <br> $$links$$ <br>"
        "plainTextLinksItemTemplate" : "<span>&bull; <a href=\"$$url$$\">$$name$$</a></span><br>",
        "plainTextLinksItemNamePlaceholder" : "$$name$$",
        "plainTextLinksItemUrlPlaceholder" : "$$url$$",
        "plainTextLinksPlaceholder" : "$$links$$"
    }
}

CommaSeparatedList

{
    "description": "Attach artifacts to order in ecommerce",
    "name": "attach-data-to-order",
    "type": "export-to-ecommerce",
    "inputArtifacts": [
        "rendered-design*"
    ],
    "parameters": {
        "dataItemType" : "commaSeparatedList",
        "dataItemKey" : "results",
        "dataItemValue": "{{rendered-design*:url}}"
    }
}

Json

{
    "description": "Attach artifacts to order in ecommerce",
    "name": "attach-data-to-order",
    "type": "export-to-ecommerce",
    "inputArtifacts": [
        "rendered-design*"
    ],
    "parameters": {
        "dataItemType" : "json",
        "dataItemKey" : "results",
        "dataItemValue": {
            "project" : "{{project.id}}",
            "urls" : [ "{{rendered-design*:url:list-json}}" ]
        }
    }      
}
Was this page helpful?
Thanks for your feedback!
Back to top Copyright © 2001–2024 Aurigma, Inc. All rights reserved.
Loading...
    Thank for your vote
    Your opinion is important to us. To provide details, send feedback.
    Send feedback