Data-Transformations

614

An illustration of what a good Data-Transformation should do.

When you're dealing with different payloads from different APIs, you need to make all the points to connect. Building a Data-Transformation for each case is the perfect solution for that problem. It's a simple JS file where you normalize your payloads into a single code.

module.exports = async (ticket) => {

    return [
        {
            "name": "subject",
            "value": ticket.summary
        },
        {
            "name": "content",
            "value": ticket.descriptionAsText
        },
        {
            "name": "hs_pipeline",
            "value": "0"
        },
        {
            "name": "hs_pipeline_stage",
            "value": "1"
        }
    ]

};
const result = await linkapi.consume.dt({ name: 'ticket-dt' }, ticket)

📘

Quick Request and Response Snippets

When you're working on Data-Transformation inside the Code Builder, the listed Resource Dependencies will have a quick snippet to call for those Components.