Solved

Adding multiple project tasks in one call.

  • 24 January 2024
  • 6 replies
  • 86 views

Badge

I am able to add a project task to an existing project using an API. How can I add multiple tasks using the same API? Is this possible? What is the syntax?

icon

Best answer by ruchikasharma23 16 February 2024, 00:14

View original

6 replies

Userlevel 7
Badge +4

Hi @abhijit,

From your post, I assume you have extended and added the Tasks entity to the endpoint. If not you can map the Tasks entity like below,

 

 

Once mapped, you can use the following syntax to add multiple Tasks in a single request,

{
"ProjectID": {
"value": "INTERNAL23"
},
"Tasks": [
{
"TaskID": {
"value": "TaskOne"
},
"Description": {
"value": "Task One"
},
"Status": {
"value": "Active"
},
"DefaultCostAccount": {
"value": "40000"
},
"DefaultCostSubaccount": {
"value": "000000"
},
"DefaultSalesAccount": {
"value": "40000"
},
"DefaultSalesSubaccount": {
"value": "000000"
},
"CompletionMethod": {
"value": "Manual"
},
"BillingOption": {
"value": "By Billing Period"
},
"BillingRule": {
"value": "INTERNAL"
},
"BillSeparately": {
"value": false
},
"AllocationRule": {
"value": "CPINT"
}
},
{
"TaskID": {
"value": "TaskTwo"
},
"Description": {
"value": "Task Two"
},
"Status": {
"value": "Active"
},
"DefaultCostAccount": {
"value": "40000"
},
"DefaultCostSubaccount": {
"value": "000000"
},
"DefaultSalesAccount": {
"value": "40000"
},
"DefaultSalesSubaccount": {
"value": "000000"
},
"CompletionMethod": {
"value": "Manual"
},
"BillingOption": {
"value": "By Billing Period"
},
"BillingRule": {
"value": "INTERNAL"
},
"BillSeparately": {
"value": false
},
"AllocationRule": {
"value": "CPINT"
}
}
]
}

Hope that helps.! Good Luck,

Badge

I am looking at ProjectTask webservice endpoint. I noticed that you added tasks under the project webservice endpoint, but I am not able to do that. I am logged in as the administrator and so I do have all the privileges.

 

Badge

I have made changes to the Project endpoint and added ProjectTask. When I use this JSON to make a call from postman, I get an error.

The JSON is

{
"ProjectID": {
"value": "PROJ-24-0000006"
},
"Tasks": [
{
"note": {
"value": "a task for a project"
},
"ActivityHistory": [],
"Default": {
"value": false
},
"Description": {
"value": "DESCRIPTION 1"
},
"ExternalRefNbr": {
"value": "140783"
},
"ProjectID": {
"value": "PROJ-24-0000006"
},
"ProjectTaskID": {
"value": "CS-140783"
},
"Status": {
"value": "In Planning"
},
"TaskCategory": {
"value": "Products & Services"
}
},
{
"note": {
"value": "a task for a project"
},
"Default": {
"value": false
},
"Description": {
"value": "DESCRIPTION 2"
},
"ExternalRefNbr": {
"value": "140784"
},
"ProjectID": {
"value": "PROJ-24-0000006"
},
"ProjectTaskID": {
"value": "CS-140784"
},
"Status": {
"value": "In Planning"
},
"TaskCategory": {
"value": "Products & Services"
}
}
]
}

 

 

Userlevel 7
Badge +4

Hi @abhijit,

From the screenshot, I see the Mapped Object and Mapped Field columns aren’t populated. 

You should be able to simply map the Tasks fields using the Populate action about that grid. 

Kindly check the To Extend an Existing Entity in the following help article, https://help.acumatica.com/(W(16))/Help?ScreenId=ShowWiki&pageid=c450492e-06fe-4563-95c3-efa76975415b

Also, I have attached the customization package with the extended endpoint. You can use it for testing and as reference, try using the JSON syntax from my previous comment. Good Luck,  

Badge

I had to modify your project since a lot of items are not applicable to me. For example, in your project it expects the projectid to be an intvalue in the tasks, but I cannot find it. After some modifications, I am getting the following error

        "exceptionMessage": "The system failed to commit the Tasks row.",

I have attached my project here. If you could spot something obvious, let me know. I am on build Build 23.112.0032 

Userlevel 5
Badge +2

Hi @abhijit 

I published your project and made the following changes to your request. It seems to work fine.

  1. Use TaskID instead of ProjectTaskID. It has been mapped as TaskID in your endpoint.

     

  2. Don’t send ProjectID in Tasks since it is not mapped in your endpoint (not needed anyway).
{
"ProjectID": {
"value": "INTERNAL23"
},
"Tasks": [
{
"note": {
"value": "a task for a project"
},
"ActivityHistory": [],
"Default": {
"value": false
},
"Description": {
"value": "DESCRIPTION 1"
},
"ExternalRefNbr": {
"value": "140783"
},
"TaskID": {
"value": "CS-140783"
},
"Status": {
"value": "In Planning"
},
"TaskCategory": {
"value": "Products & Services"
}
},
{
"note": {
"value": "a task for a project"
},
"Default": {
"value": false
},
"Description": {
"value": "DESCRIPTION 2"
},
"ExternalRefNbr": {
"value": "140784"
},
"TaskID": {
"value": "CS-140784"
},
"Status": {
"value": "In Planning"
},
"TaskCategory": {
"value": "Products & Services"
}
}
]
}

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved