---
title: Scriptable conditions in a mapping
description: Define PingIDM scriptable conditions and condition filters in a mapping to control which attributes are synchronized based on evaluated criteria
component: pingidm
version: 8.1
page_id: pingidm:synchronization-guide:mapping-conditions
canonical_url: https://docs.pingidentity.com/pingidm/8.1/synchronization-guide/mapping-conditions.html
llms_txt: https://docs.pingidentity.com/pingidm/llms.txt
docs_for_agents: https://developer.pingidentity.com/build-with-ai/docs-for-agents.md
keywords: ["Synchronization", "Mappings", "Scripts"]
section_ids:
  mapping-conditions-ui: Configure mapping conditions using the admin UI
  using_the_platform_admin_ui: Using the Platform admin UI
  using_the_legacy_admin_ui: Using the legacy admin UI
---

# Scriptable conditions in a mapping

By default, IDM synchronizes all attributes in a mapping. For more complex relationships between source and target objects, you can define conditions under which IDM maps certain attributes. You can define two types of mapping conditions:

* *Scriptable conditions*, in which an attribute is mapped only if the defined script evaluates to `true`.

* *Condition filters*, a declarative filter that sets the conditions under which the attribute is mapped. Condition filters can include a *link qualifier* , that identifies the *type* of relationship between the source object and multiple target objects. For more information, refer to [Map a Single Source Object to Multiple Target Objects](linking-multiple-targets.html).

  The following list shows examples of condition filters:

  * `"condition": "/object/country eq 'France'"`—Only map the attribute if the object's `country` attribute equals `France`.

  * `"condition": "/object/password pr"`—Only map the attribute if the object's `password` attribute is present.

  * `"condition": "/linkQualifier eq 'admin'"`—Only map the attribute if the link between this source and target object is of type `admin`.

## Configure mapping conditions using the admin UI

|   |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| - | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|   | Starting with IDM 8.1, the [legacy admin UI is deprecated](../release-notes/deprecated-functionality.html#legacy-admin-ui-deprecated) and is no longer bundled with IDM. New deployments should use the [Platform admin UI](../setup-guide/platform-admin-ui.html), which is the replacement for the legacy admin UI.Both UIs are available as separate downloads from the [Backstage download site](https://backstage.pingidentity.com/downloads):- To install the Platform admin UI, follow the steps in [Install the Platform admin UI for standalone IDM](../setup-guide/platform-admin-ui.html).

- To continue using the legacy admin UI, follow the steps in [Install the legacy admin UI](../setup-guide/legacy-admin-ui.html). |

### Using the Platform admin UI

To configure a mapping condition using the Platform admin UI:

1. Open the [Advanced Sync](cfg-mapping-resource.html#mappings-platform-ui) editor, and click the property to edit on the Mapping tab.

2. Click Show advanced settings, and select Apply conditional update.

3. Choose one of the following ways to conditionally update the attribute:

   * To use filter fields, make sure Filter is selected, and use the fields to set the conditions that must occur to update the attribute.

   * To use a filter query, make sure Filter is selected, click Advanced Editor, and edit the query filter.

   * To use a script, click Script, and modify the script in the Conditional Update Script field.

4. Click Save.

### Using the legacy admin UI

To configure a mapping condition using the legacy admin UI:

1. From the navigation bar, click Configure > Mappings, and click the mapping to edit.

2. Click the Properties tab.

3. Expand the Attributes Grid node, click the property to edit, click the Conditional Updates tab, and then do one of the following:

   * To configure a filtered condition, click Condition Filter.

   * To configure a scriptable condition, click Script.

4. Click Save.

Scriptable conditions create mapping logic, based on the result of the condition script. If the script does not return `true`, IDM does not manipulate the target attribute during a synchronization operation.

In the following excerpt, the value of the target `mail` attribute is set to the value of the source `email` attribute *only if* the source attribute is not empty:

```json
{
    "target": "mail",
        "comment": "Set mail if non-empty.",
        "source": "email",
        "condition": {
            "type": "text/javascript",
            "source": "(object.email != null)"
        }
...
```

|   |                                                                                                                                                                                                                                                         |
| - | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|   | You can add comments to JSON files. This example includes a property named `comment`; however, you can use any unique property name, as long as it is not used elsewhere in the server. IDM ignores unknown property names in JSON configuration files. |
