Not able to create a case using multiple Objects In Creatio
When we are creating a case using single object, the cases are getting created. But when we are trying to create using multiple objects we are getting the null response. I'm posting the requests and response and the screenshots below.
Like
Hello,
The InsertQuery endpoint in the DataService doesn't support an array of objects in the body. If you are using InsertQuery for data creation, you can pass only one record (object) in the body. You can use BatchQuery, which contains an array of InsertQueries, or other endpoints of the DataService to create multiple records.
More information about DataService can be found here: https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/dataservice-references
But I recommend using the OData v4 API for data access from an integration. You can find additional information about OData v4 in the Creatio Academy article here: https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/category/odata
Also here is a body for the BatchQuery (example) to insert two case records into the system (maybe it will be helpful). The endpoint to call is /0/DataService/json/SyncReply/BatchQuery (POST request):
{ "items":[ { "__type":"Terrasoft.Nui.ServiceModel.DataContract.InsertQuery", "operationType":1, "rootSchemaName":"Case", "columnValues":{ "items":{ "CreatedBy":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"Supervisor", "primaryColorValue":null, "value":"410006e1-ca4e-4502-a9ec-e54d922d2c00" } } }, "ModifiedBy":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"Supervisor", "primaryColorValue":null, "value":"410006e1-ca4e-4502-a9ec-e54d922d2c00" } } }, "Number":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":null } }, "Subject":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":"Test (from Postman 1)" } }, "Symptoms":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":null } }, "Owner":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "ResponseDate":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "SolutionDate":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "Status":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"New", "primaryColorValue":"#0058EF", "value":"ae5f2f10-f46b-1410-fd9a-0050ba5d6c38" } } }, "Priority":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"Medium", "primaryColorValue":null, "value":"d9bd322c-f46b-1410-ee8c-0050ba5d6c38" } } }, "Origin":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"Call", "primaryColorValue":null, "value":"5e5e202a-f46b-1410-3692-0050ba5d6c38" } } }, "Account":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "Contact":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "IsChanged":false, "PrimaryModelMode":"update", "HasUnsavedData":false, "value":"c4ed336c-3e9b-40fe-8b82-5632476472b4", "displayValue":"Andrew Baker (sample)", "State":"Active" } } }, "Group":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "RespondedOn":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "SolutionProvidedOn":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "ClosureDate":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "ClosureCode":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "Solution":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":null } }, "SatisfactionLevel":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "Category":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "SatisfactionLevelComment":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":null } }, "ServiceItem":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "ServicePact":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "FirstSolutionProvidedOn":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "SolvedOnSupportLevel":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "SupportLevel":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"1st-line support", "primaryColorValue":null, "value":"ff7f2f92-f36b-1410-3d9c-0050ba5d6c38" } } }, "ParentCase":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } } } }, "queryKind":0 }, { "__type":"Terrasoft.Nui.ServiceModel.DataContract.InsertQuery", "operationType":1, "rootSchemaName":"Case", "columnValues":{ "items":{ "CreatedBy":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"Supervisor", "primaryColorValue":null, "value":"410006e1-ca4e-4502-a9ec-e54d922d2c00" } } }, "ModifiedBy":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"Supervisor", "primaryColorValue":null, "value":"410006e1-ca4e-4502-a9ec-e54d922d2c00" } } }, "Number":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":null } }, "Subject":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":"Test (from Postman 2)" } }, "Symptoms":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":null } }, "Owner":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "ResponseDate":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "SolutionDate":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "Status":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"New", "primaryColorValue":"#0058EF", "value":"ae5f2f10-f46b-1410-fd9a-0050ba5d6c38" } } }, "Priority":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"Medium", "primaryColorValue":null, "value":"d9bd322c-f46b-1410-ee8c-0050ba5d6c38" } } }, "Origin":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"Call", "primaryColorValue":null, "value":"5e5e202a-f46b-1410-3692-0050ba5d6c38" } } }, "Account":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "Contact":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "IsChanged":false, "PrimaryModelMode":"update", "HasUnsavedData":false, "value":"c4ed336c-3e9b-40fe-8b82-5632476472b4", "displayValue":"Andrew Baker (sample)", "State":"Active" } } }, "Group":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "RespondedOn":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "SolutionProvidedOn":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "ClosureDate":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "ClosureCode":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "Solution":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":null } }, "SatisfactionLevel":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "Category":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "SatisfactionLevelComment":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":null } }, "ServiceItem":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "ServicePact":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "FirstSolutionProvidedOn":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "SolvedOnSupportLevel":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "SupportLevel":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"1st-line support", "primaryColorValue":null, "value":"ff7f2f92-f36b-1410-3d9c-0050ba5d6c38" } } }, "ParentCase":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } } } }, "queryKind":0 } ], "includeProcessExecutionData":true }
Hello,
The InsertQuery endpoint in the DataService doesn't support an array of objects in the body. If you are using InsertQuery for data creation, you can pass only one record (object) in the body. You can use BatchQuery, which contains an array of InsertQueries, or other endpoints of the DataService to create multiple records.
More information about DataService can be found here: https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/dataservice-references
But I recommend using the OData v4 API for data access from an integration. You can find additional information about OData v4 in the Creatio Academy article here: https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/category/odata
Also here is a body for the BatchQuery (example) to insert two case records into the system (maybe it will be helpful). The endpoint to call is /0/DataService/json/SyncReply/BatchQuery (POST request):
{ "items":[ { "__type":"Terrasoft.Nui.ServiceModel.DataContract.InsertQuery", "operationType":1, "rootSchemaName":"Case", "columnValues":{ "items":{ "CreatedBy":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"Supervisor", "primaryColorValue":null, "value":"410006e1-ca4e-4502-a9ec-e54d922d2c00" } } }, "ModifiedBy":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"Supervisor", "primaryColorValue":null, "value":"410006e1-ca4e-4502-a9ec-e54d922d2c00" } } }, "Number":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":null } }, "Subject":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":"Test (from Postman 1)" } }, "Symptoms":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":null } }, "Owner":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "ResponseDate":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "SolutionDate":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "Status":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"New", "primaryColorValue":"#0058EF", "value":"ae5f2f10-f46b-1410-fd9a-0050ba5d6c38" } } }, "Priority":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"Medium", "primaryColorValue":null, "value":"d9bd322c-f46b-1410-ee8c-0050ba5d6c38" } } }, "Origin":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"Call", "primaryColorValue":null, "value":"5e5e202a-f46b-1410-3692-0050ba5d6c38" } } }, "Account":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "Contact":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "IsChanged":false, "PrimaryModelMode":"update", "HasUnsavedData":false, "value":"c4ed336c-3e9b-40fe-8b82-5632476472b4", "displayValue":"Andrew Baker (sample)", "State":"Active" } } }, "Group":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "RespondedOn":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "SolutionProvidedOn":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "ClosureDate":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "ClosureCode":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "Solution":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":null } }, "SatisfactionLevel":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "Category":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "SatisfactionLevelComment":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":null } }, "ServiceItem":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "ServicePact":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "FirstSolutionProvidedOn":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "SolvedOnSupportLevel":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "SupportLevel":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"1st-line support", "primaryColorValue":null, "value":"ff7f2f92-f36b-1410-3d9c-0050ba5d6c38" } } }, "ParentCase":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } } } }, "queryKind":0 }, { "__type":"Terrasoft.Nui.ServiceModel.DataContract.InsertQuery", "operationType":1, "rootSchemaName":"Case", "columnValues":{ "items":{ "CreatedBy":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"Supervisor", "primaryColorValue":null, "value":"410006e1-ca4e-4502-a9ec-e54d922d2c00" } } }, "ModifiedBy":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"Supervisor", "primaryColorValue":null, "value":"410006e1-ca4e-4502-a9ec-e54d922d2c00" } } }, "Number":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":null } }, "Subject":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":"Test (from Postman 2)" } }, "Symptoms":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":null } }, "Owner":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "ResponseDate":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "SolutionDate":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "Status":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"New", "primaryColorValue":"#0058EF", "value":"ae5f2f10-f46b-1410-fd9a-0050ba5d6c38" } } }, "Priority":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"Medium", "primaryColorValue":null, "value":"d9bd322c-f46b-1410-ee8c-0050ba5d6c38" } } }, "Origin":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"Call", "primaryColorValue":null, "value":"5e5e202a-f46b-1410-3692-0050ba5d6c38" } } }, "Account":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "Contact":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "IsChanged":false, "PrimaryModelMode":"update", "HasUnsavedData":false, "value":"c4ed336c-3e9b-40fe-8b82-5632476472b4", "displayValue":"Andrew Baker (sample)", "State":"Active" } } }, "Group":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "RespondedOn":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "SolutionProvidedOn":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "ClosureDate":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "ClosureCode":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "Solution":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":null } }, "SatisfactionLevel":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "Category":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "SatisfactionLevelComment":{ "expressionType":2, "parameter":{ "dataValueType":1, "value":null } }, "ServiceItem":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "ServicePact":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "FirstSolutionProvidedOn":{ "expressionType":2, "parameter":{ "dataValueType":7, "value":null } }, "SolvedOnSupportLevel":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } }, "SupportLevel":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":{ "displayValue":"1st-line support", "primaryColorValue":null, "value":"ff7f2f92-f36b-1410-3d9c-0050ba5d6c38" } } }, "ParentCase":{ "expressionType":2, "parameter":{ "dataValueType":10, "value":null } } } }, "queryKind":0 } ], "includeProcessExecutionData":true }