# Initialize Artifact UDFs

**Available from:** Clarity LIMS v2.0.5

This section discusses using the *initArtifactUDFs* script to transfer the UDFs associated with samples and processes to downstream artifacts. Typically, the script is used to copy UDFs from sample inputs and processes to sample outputs.

## Script Overview

For each output, the *initArtifactUDFs* script searches for UDFs of the same name - in both the input samples and the process. If a match is found, it then copies the UDF values to the corresponding UDFs on the sample output.

**How it works:**

1. Identify the list of sample UDFs configured as output UDFs for this process (e.g. as would be defined in the 'Output Details' section of the process configuration).
2. For each sample UDF, look for an identically named UDF on the submitted sample; if a match exists, copy the value from the submitted sample to the sample's output UDF. If there is no UDF match, do nothing.
3. For each sample UDF, look for an identically named UDF on the process; if a match exists, copy the value from the process to the sample's output UDF. If there is no UDF match, do nothing.
4. Typically, the values will be derived from the submitted sample(s). In some cases, there will also be a need to copy data from the process level (specified by the user executing the process) down to each sample output UDF.
5. In some cases, there may be a need to account for pooling - i.e., where there are multiple submitted samples for a single output sample. The basic strategy here is to create small groupings of these values, such that each grouping does not contain multiple entries of the same UDF value.

**Useful information**

* If both process and any number of samples have values for the same UDF name, the process UDF value is used.
* If multiple samples have different values for the same UDF name, the values are combined using '+' as a separator (up to 5 values, additional values are omitted and represented with ''...').
* In the case where an output UDF value already exists, the *initArtifactUDFs* script will NOT override existing values. (This scenario is extremely rare - one has to be very fast to manually set UDF values before an EPP script runs.)

## Script Parameters

| **Parameter**      | **Description**                |
| ------------------ | ------------------------------ |
| -u {username}      | (Required) LIMS login username |
| -p {password}      | (Required) LIMS login password |
| -i {processURI:v2} | (Required) LIMS process URI    |

## Command Line Example

<details>

<summary>Example</summary>

{% code overflow="wrap" %}

```markup
bash -l -c "/opt/gls/clarity/bin/java -jar \
/opt/gls/clarity/extensions/ngs-common/v5/EPP/ngs-extensions.jar \
script:initArtifactUDFs \
-u {username} \
-p {password} \
-i {processURI:v2}"
```

{% endcode %}

> ℹ In the example shown above, the paths may differ for your system. For example, the version number may differ.

</details>


---

# 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.claritylims.illumina.com/instruments-and-integrations/ngs/ngs-initialize-artifact-udfs.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.
