---
title: Create script
description: Connectors continue to be released outside the IDM release. For the latest documentation, refer to the OpenICF documentation.
component: pingidm
version: 7.2
page_id: pingidm:connector-dev-guide:scripts/script-create
canonical_url: https://docs.pingidentity.com/pingidm/7.2/connector-dev-guide/scripts/script-create.html
---

# Create script

|   |                                                                                                                                                                                   |
| - | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|   | Connectors continue to be released outside the IDM release. For the latest documentation, refer to the [OpenICF documentation](https://docs.pingidentity.com/openicf/index.html). |

A create script creates a new object on the external resource. If your connector does not support creating an object, this script should throw an `UnsupportedOperationException`.

A sample create script for an SQL database is provided in `openidm/samples/scripted-sql-with-mysql/tools/CreateScript.groovy`.

* Input variables

  The following variables are available to a create script:

  * configuration

    A handler to the connector's configuration object.

  * options

    A handler to the Operation Options.

  * operation

    An OperationType that corresponds to the action (`CREATE`).

  * objectClass

    The object class that is created, such as `__ACCOUNT__` or `__GROUP__`.

  * attributes

    The set of attributes that describe the object to be created.

  * id

    The UID of the object to be created, if specified. If the UID is `null`, the UID should be generated by the server. The UID corresponds to the OpenICF `__NAME__` attribute if it is provided as part of the attribute set.

  * log

    A logger instance for the connector.

* Returns

  The user unique ID (OpenICF `__UID__`) of the newly created object. The `type` of the returned UID must be a `string` or a `Uid`. If a null value or an object type other than `string` or `Uid` is returned, the script must throw an exception.

Create Script

```groovy
def operation = operation as OperationType
 def configuration = configuration as SapConfiguration
 def log = log as Log
 def objectClass = objectClass as ObjectClass
 def createAttributes = new AttributesAccessor(attributes as Set<Attribute>)
 def name = id as String
 def options = options as OperationOptions

 log.info("Entering {0} script",operation);


 assert operation == OperationType.CREATE, 'Operation must be a CREATE'
 // We only deal with users
 assert objectClass.getObjectClassValue() == ObjectClass.ACCOUNT_NAME


 def password = createAttributes.getPassword() as GuardedString;
 assert password != null, 'Password must be provided on create'


 //...
 def uid = createTheUser(createAttributes);
 return uid
```
