# Copying UDF Values from Source to Destination

How to copy the value of a UDF/custom field from source to destination (typically from the inputs of a process/step to the outputs) is a frequently asked question.

For example, suppose a process/step takes in libraries and tracks their normalization. In such a case, the input samples have a UDF/custom field that is used to track the library ID. Since the library ID changes, it is desirable for the output samples to also have this ID.

### Solution

Use the API to gather the XML for the inputs, then copy the XML node relating to the UDF/custom field to the outputs.

Alternatively, use the out-of-the-box copyUDFs script, which Illumina provides as part of the NextGen Sequencing configuration.

### Script

The **copyUDFs** script is available in the **ngs-extensions.jar** archive\*, and can be called from the EPP / automation parameter string.

The archive file may be named differently, depending upon the version you are running.

Usage:

```
java -jar ngs-extensions.jar -u {username} -p {password} -i {processURI} \
script:copyUDFs -f <myUDF1>,<myUDF2>,<myUDF3>
```

#### Defining the UDF / custom field values

The UDF / custom field values to be copied are defined in the **-f** portion of the syntax. These values must be present on both the inputs and outputs of a process.

For example, suppose you wanted to use this script to copy the value of a UDF called **Library ID**:

* The **Library ID** field must be defined on both inputs and outputs.
* The **-f** flag is defined as follows:

  ```
  -f "Library ID"
  ```

To copy **multiple UDF values** from source to destination, list them in comma-separated form as part of the **-f** flag.

* To copy **Library ID** and **Organism** from source to destination, use the following example:

  ```
  -f "Library ID", "Organism"
  ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.connected.illumina.com/clarity-lims/api-and-database/api-docs/tips-and-tricks/copying-udf-values-from-source-to-destination.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
