Share this page

# createResourcePools

## Purpose

This operation creates one or more new resource pool objects in PPM Center.

## Function and Parameters

This operation creates one or more (maximum 1,000) new resource pool objects, identified by resource pool ID in PPM Center.

The user performing this operation must have the following access grants:

- Create Resource Pools

- Edit Resource Pool or Edit All Resource Pools

Required Fields:

- Name

- Region

Optional Fields:

- ID

- Description

- Parent

- Org unit

- Manager

- Note

- Child

- Access Control

If these optional fields are not set, no defaults are used.

## Limitations

This operation has the following limitations:

- User data cannot be created.

- This operation assumes basic data exists in the database. The following data must exist in any production PPM Center instance.

  - Resources

  - Users

  - Parent resource pool

  - Org Unit

  - Region

  All values provided in the parameters must comply with what is expected in PPM Center. The possible values are provided above when each parameter is described.

- If a data problem occurs with any data provided for the resource pools, the entire data set is rejected. No resource pools are created.

## Related Information

updateResourcePools - update fields of an existing resource pool.

## Input

An array of ResourcePools.

## Return

An array of ResourcePoolReferences.

## Java Interface

`CreateResourcePoolsResponseDocument createResourcePools( CreateResourcePoolsDocument in)`

Parameters | Description
--- | ---
CreateResourcePoolsDocument | Wrapper of the resource pool array object (WSResourcePoolBean[]). See the following example for the construction. The bean includes the following fields: Long id; String name; String description; ResourcePoolRefernce parent; RegionReference region; OrgUnitReference orgUnit; List manager; List Notes; ResourcePoolRefernce[] child; ResourcePoolAccessControlBean[] aces;
CreateResourcePoolsResponseDocument | Wrapper for the resource pool ref array (ResourcePoolReference[]). See the following example for retrieving the bean and its fields.

## Java Examples

Example: create a new resource pool.

    /**
        * Test creating a resource pool with values for all fields, reading it back out and searching for it.
        */
       public long testCreateResourcePool() throws Exception {

           // create the resource pool object
    ResourcePool resourcePool1 =
    createTestResourcePoolObject("TestResourcePool1");
    ResourcePool resourcePool2 =
    createTestResourcePoolObject("TestResourcePool2");

          // call the service
    ResourcePoolReference[] resourcePoolReference =
    createResourcePools(new ResourcePool[] { resourcePool1,
    resourcePool2 });

            // return first pool ID
    return resourcePoolReference[0].getId();

        }
    /**
         * This is a wrapper method around the createResourcePools
    web service. It handles the details of creating
        * the document, invoking the web service and unwrapping the
    response.
         *
         * @param resourcePools Zero or more resource pools to
    create in PPM.
         * @return A resource pool reference for each object that
    was successfully created.
         * @throws Exception
         */
        ResourcePoolReference[] createResourcePools(ResourcePool[]
    resourcePools) throws Exception {
            ResourceServiceStub service = new
    ResourceServiceStub(ctx, WSURL);
        CreateResourcePoolsDocument createResourcePoolsDoc =
    CreateResourcePoolsDocument.Factory.newInstance();

    createResourcePoolsDoc.addNewCreateResourcePools().setResourceP
    oolArray(resourcePools);
        CreateResourcePoolsResponseDocument responseDocCreate =
    service.createResourcePools(createResourcePoolsDoc);

    CreateResourcePoolsResponse responseCreate =
    responseDocCreate.getCreateResourcePoolsResponse();

    debugPrint(responseCreate, "create response");

    return responseCreate.getResourcePoolRefArray();
        }

        public static ResourcePool
    createTestResourcePoolObject(String name) {

            ResourcePool resourcePool =
    ResourcePool.Factory.newInstance();

            // resource pool name
            resourcePool.setName(name);

            // description
            resourcePool.setDescription("A resource pool created
    programmatically through web services ");

            // region
            resourcePool.addNewRegion().setName("America");

            // pool managers
            resourcePool.addNewManager().setName("admin");

            // set parent pool
            resourcePool.addNewParent().setName("parent pool
    name");

            // add children pool
            resourcePool.addNewChild().setName("child pool name");

            // org unit
            resourcePool.addNewOrgUnit().setName(" org unit name");

            // add notes
            Note note = resourcePool.addNewNote();
            note.setContent("Note content");
            note.setAuthor("admin");

            // set access control list

            for (int i = 0; i < usersInACL.length; i++) {
                ResourcePoolAccessControlBean acb =
    resourcePool.addNewACEs();
               ResourceReference aceUser = acb.addNewUser();
               aceUser.setName(usersInACL[i]);
               acb.setCanEditHeader(true);
               acb.setCanEditSecurity(true);
               acb.setCanEditUnnamedHeadCount(false);
            }

            return resourcePool;
         }
    }

## Errors and Exceptions

When an error occurs on this operation, you will receive a description of the root cause in the log or in the response message.

The server log file content is similar to the following:

    Exception in thread "main" org.apache.axis2.AxisFault:
    <exception:exceptionDetails xmlns:exception="http://
    www.mercury.com/ppm/ws/exception">
    <exception:detail>[root cause description] </exception:detail>
    </exception:exceptionDetails>

Possible root cause descriptions:

:

Message Code | Message | Cause(s) | Possible Corrective Action
--- | --- | --- | ---
error.ws.maxResourcePools | The maximum number of resource pools to process in a single web service transaction may not exceed 1000. | The number of resource pools exceeds 1,000. | Break up the list of resource pools into smaller chunks and process over multiple transactions.
error.ws.create.duplicateName | A resource pool with the name "{0}" already exists. Enter a different name. | A resource pool with the name already exists. | Enter a different name.
error.ws.create.cycle | Cannot create resource pool as it would introduce a cyclical parent-child relationship between the resource pools {0} and {1}. | Two resource pools have each other as parents. | Make sure that the resource pools do not have each other as parents.
error.ws.regionRequired | Resource pool region is required. Specify a region for each resource pool. | The region for a resource pool is not specified. | Specify the region for the resource pool.
error.ws.nameRequired | Resource pool name cannot be blank. Provide a name for each resource pool. | The resource pool name is not set for a pool. | Set the resource pool name.
error.ws.descriptionTooLong | Description cannot be longer than 650 characters. | Description of a resource pool is more than 650 characters. | Reduce length of description.
error.ws.nameTooLong | Name cannot be longer than 260 characters. | Name of a resource pool is great than 260. | Reduce length of name.
N/A | Entity Validation errors if region, manager, resource pool does not exist. | Resource pool region, manager, or parent resource pool does not exist. | Ensure that Resource pool region, manager, and parent resource pool exist for all pools to be created before this web service call.

https://admhelp.microfocus.com PPM 8942
Tips to improve your search results... OpenText™ Project and Portfolio Management Help Center PPM Help 26.2-26.3 All View Local Help Center View Online Help Center Version: