Create a Project from a Project Template

By using the REST API, you can create a project from a project template. For details about project templates, see Project Templates and Common Tasks: General Information.

System Preparation

Before you test the code below, you need to configure your client application and the MYOB Acumatica instance to be used as follows:
  1. Deploy a new MYOB Acumatica instance with the U100 dataset. For details on deploying an instance, see Instance Deployment: To Deploy an Instance with Demo Data.
  2. On the Enable/Disable Features (CS100000) form, make sure the Projects feature is enabled.
  3. To sign in to the instance in the client application, use the tenant name (which you specified when you created the instance) and the HEADOFFICE branch.
  4. If you are using Postman as the client application for testing, in the IntegrationDevelopmentGuide.postman_collection.json collection, make sure that the collection’s variables have the proper values. This collection is located in the IntegrationDevelopment\Help folder of the Help-and-Training-Examples repository on GitHub.

Request

You can use the following example of an HTTP request to create a project from the PROGRESS project template and specify the Customer, BillingRule, and BillingPeriod settings of the project through the contract-based REST API.
Tip: In the request example below, <MYOB Acumatica instance URL> is the URL of the MYOB Acumatica instance (such as https://my.acumatica.com/MyInstance). You can omit the instance name in the URL (that is, you can use https://my.acumatica.com) if the instance is installed in the root of the website.
PUT / HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/24.200.001/Project
Accept: application/json
Content-Type: application/json

{
    "ProjectID" : {"value" : "TESTPR3"},
    "ProjectTemplateID" : {"value" : "PROGRESS"},
    "Customer" : {"value" : "COFFEESHOP"},
    "BillingAndAllocationSettings" :
    {
        "BillingRule" : {"value" : "PROGRESS"},
        "BillingPeriod" : {"value" : "Month"},
    }
}

Usage Notes

By using the REST API, you can create pro forma invoices and send them by email. For details about pro forma invoices, see Pro Forma Invoices: General Information.

For a pro forma invoice to be created from a project, the project must have Customer, BillingRule, BillingPeriod, and NextBillingDate specified, and must have the Active status. Because of data validation in the project, NextBillingDate cannot be specified for a project with the In Planning status, and you cannot change the customer in a project with the Active status. Therefore, these settings can be specified only in multiple API calls, as shown in the code examples below.

A ProFormaInvoice entity can be created through the invocation of the RunProjectBilling action of the Project entity. Because email settings are not mapped to any fields of the Project entity, you have to prepare a project template with the specified email settings on the Project Templates (PM208000) form and then use this template for the creation of the project through the API. The project template can also contain preconfigured project tasks, as is the case with the PROGRESS template, which is preconfigured in the U100 dataset and used in this example. For details about project templates, see Project Templates and Common Tasks: General Information.

You may use the following sequence of requests while creating pro forma invoices and sending them by email:

  1. Create a Project from a Project Template
  2. Make a Project Active
  3. Specify the Next Billing Date for a Project
  4. Retrieve a Project Task
  5. Activate a Project Task
  6. Specify the Progress of a Project Task
  7. Invoke Project Billing
  8. Retrieve the List of Pro Forma Invoices of a Project
  9. Send a Pro Forma Invoice by Email