Share this page

# createPortfolio

## Purpose

This operation creates a portfolio.

## Function

You can use this operation to create a new portfolio in PPM Center.

## Related Information

The following related operations:

- readPortfolio

- updatePortfolio

- deletePortfolio

## Input

This operation requires the following input:

- The portfolio name

- The usernames of the portfolio managers

## Return

A PortfolioWSBean object with the ID, name and the set of managers populated.

## Java Interface

`CreatePortfolioResponseDocument`
`createPortfolio(CreatePortfolioDocument param`

Parameters | Description
--- | ---
CreatePotfolioDocument | Wrapper for PortfolioWSBean. See the Java example for construction. The bean includes the following fields: String name String[] managers //array of the user names of the managers
CreatePortfolioResponseDocument | Wrapper for PortfolioWSBean. See the Java example for how to retrieve the bean and its fields.

## Java Examples

    public Portfolio testCreatePortfolio(String portfolioName,
    String[] managers) throws Exception {
           System.out.println("testCreatePortfolio started ...");
           PortfolioServiceStub stub = new PortfolioServiceStub(ctx,
    WSURL);
           CreatePortfolioDocument createPortfolioDocument =
    CreatePortfolioDocument.Factory.newInstance();
           final CreatePortfolioInput newPortfolio =
    createPortfolioDocument.addNewCreatePortfolio().addNewPortfolio
    ();
           newPortfolio.setName(portfolioName);
           newPortfolio.setManagerUserNameArray(managers);
           CreatePortfolioResponseDocument response =
    stub.createPortfolio(createPortfolioDocument);
           Portfolio createdPortfolio =
    response.getCreatePortfolioResponse().getPortfolio();
           System.out.println("Created Portfolio " + portfolioName +
    " with id " + createdPortfolio.getId());
           System.out.println("testCreatePortfolio completed");
           return createdPortfolio;
    }

## Errors and Exceptions

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

The server log 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
--- | --- | --- | ---
exception.authorization | You do not have the privilege to take this action. Please consult your PPM Administrator. | You are not authorized to create a portfolio. | Check the user licenses and privileges (access grants)
com.mercury.itg.pfm.service.PFMDataValidationException | Portfolio Name already exists. | A portfolio with the specified name already exists. | Change the portfolio name.
com.mercury.itg.pfm.service.PFMDataValidationException | One or more of the portfolio managers do not exist in PPM | One or more of the specified usernames do not exist in PPM Center. | Check the usernames.

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: