---
title: Remote proxy scripting examples
description: JavaScript scripting examples for querying, creating, and updating users through the PingIDM remote proxy
component: pingidm
version: 8.1
page_id: pingidm:objects-guide:remote-proxy-scripting-examples
canonical_url: https://docs.pingidentity.com/pingidm/8.1/objects-guide/remote-proxy-scripting-examples.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: ["Data Object Model", "Synchronization"]
section_ids:
  remote-proxy-script-query: Query remote users
  remote-proxy-script-create: Create a user on the remote instance
  remote-proxy-script-update: Update a remote user
---

# Remote proxy scripting examples

After you've created a mapping, you can manage the remote instance using a [script function](../scripting-guide/scripting-func-ref.html):

## Query remote users

```javascript
// Query users on the remote instance
var remoteUsers = openidm.query(
  "external/idm/<remote-instance-name>/managed/user",
  {
    "_queryFilter": "userName eq 'bjensen'"
  }
);

logger.info("Found {} remote users", remoteUsers.result.length);
```

## Create a user on the remote instance

```javascript
var newUser = openidm.create(
  "external/idm/<remote-instance-name>/managed/user",
  null,
  {
    "userName": "jdoe",
    "givenName": "John",
    "sn": "Doe",
    "mail": "jdoe@example.com",
    "password": "<password>"
  }
);

logger.info("Created remote user: {}", newUser._id);
```

## Update a remote user

```javascript
var updatedUser = openidm.patch(
  "external/idm/<remote-instance-name>/managed/user/95b2b43c-621e-4bca-8a97-efc768f17751",
  null,
  [
    {
      "operation": "replace",
      "field": "/mail",
      "value": "newemail@example.com"
    }
  ]
);
```
