# Function Creation Process

Every function object has the following parameters:

* **Name:** This is the value that will appear in the selection in a Tag configuration. Here, you should use a descriptive name.
* **ID**: This technical reference can explicitly reference a function, as this ID is unique per DCP.
* **Description**: Feel free to describe your Function to better understand the motivation to this application later.
* **Javascript**: This is the actual function code that you will define

<figure><img src="https://2315305008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy15ncufYr341K5U8q6Of%2Fuploads%2Fgit-blob-056ccfd1fe62ae96c83437ea5a5d6c884203348b%2FScreenshot%202025-07-22%20at%2008.36.47.png?alt=media" alt=""><figcaption></figcaption></figure>

As a function is referenced in a tag to process and return a value, you must define an input and output value. Use the following basic syntax, as any function must return a value.

{% hint style="warning" %}
Functions can only work with **one input**. Adding more variables in the tag edit view will concatenate the inputs into a single parameter.
{% endhint %}

{% code lineNumbers="true" %}

```javascript
async function(input){
  var processed_value = input+1;
  return processed_value;
}
```

{% endcode %}

### Transformation Functions

Any transformation function that runs server-side can fully support async features like \`await\` and \`promise\`.

Hence, if you intend to use async features, you must always declare the code to be async in the first line of code.

{% code lineNumbers="true" %}

```javascript
async function _(input) {
  // use await or promise if required
}
```

{% endcode %}

{% hint style="danger" %}
You can not use async features on client-side executed transformation functions, so the same transformation functions are not applicable to both client—and server-side tags.
{% endhint %}

### Workaround for multiple arguments

If you need multiple input arguments, a possible workaround is to use a delimiter to concatenate the different variables and then split the information within the function.

<figure><img src="https://2315305008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy15ncufYr341K5U8q6Of%2Fuploads%2Fgit-blob-3bf28cbc9799d340b6f0cd8ac4673d753fad0f3e%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

{% code title="Example Function Code" lineNumbers="true" %}

```javascript
function  hashed_id_sha256(args) {
    let params = args.split(':::');
    let id = params[0];
    let account = params[1];

    if (['abc','cdf'].includes(account)) {
        return this.tools.getSHA256(id);
    }

    return id;
}
```

{% endcode %}
