Solved

Opportunity.Subject: 'Subject' cannot be empty.\nInserting 'Opportunity' record raised at least one error. Please review the errors.

  • 19 December 2021
  • 3 replies
  • 102 views

Hi Team,

 

I am trying to create opportunity through rest API and it worked first time. I tried to create another opportunity it gives me below error: Although the model is same which I have passed first time just subject is different. I have observed that If I delete all the opportunities then it works fine but it is not creating 2nd opportunity event for another business account.

URL: /entity/Default/18.200.001/Opportunity 

Model: 

{

    "BusinessAccount": {

        "value": "4424"

    },

    "ClassID": {

        "value": "STUDENT"

    },

    "ConvertedLeadDisplayName": {},

    "ConvertedLeadID": {},

    "CurrencyID": {

        "value": "AUD"

    },

    "CurrencyViewState": {

        "value": false

    },

    "Details": {},

    "Discount": {

        "value": 0

    },

    "Location": {

        "value": "MAIN"

    },

    "ManualAmount": {

        "value": false

    },

    "OpportunityID": {

        "value": "E1223"

    },

    //"Override": {

    //    "value": true

    //},

    "Owner": {},

    "OwnerEmployeeName": {},

    "ParentAccount": {},

    "Reason": {

        "value": "In Process"

    },

    "Source": {},

    "SourceCampaign": {},

    "Stage": {

        "value": "Prospect"

    },

    "Status": {

        "value": "Open"

    },

    "Subject": {

        "value": "asg"

    },

    "TaxZone": {},

    "WeightTotal": {

        "value": 0

    },

    "WorkgroupDescription": {},

    "WorkgroupID": {},

    "custom": {},

    "files": [],

    

}

 

Response:

 

{

    "message": "An error has occurred.",

    "exceptionMessage": "Opportunity.Subject: 'Subject' cannot be empty.\nInserting  'Opportunity' record raised at least one error. Please review the errors.",

    "exceptionType": "PX.Api.ContractBased.OutcomeEntityHasErrorsException",

    "stackTrace": "   at PX.Api.ContractBased.EntityService.GetOperationResult(EntityImpl entity, EntityExportContextBuilder entityExportContextBuilder, PXSYTable exportedKeys, PXOuterException contextError, Boolean throwOnError, Boolean addCancelCommand)\r\n   at PX.Api.ContractBased.EntityService.Put(ISystemContract systemContract, String version, String name, EntityImpl entity, CbOperationContext operationContext, Boolean throwOnError)\r\n   at PX.Api.ContractBased.Soap.SoapFacadeBase.PutImpl(EntityImpl entity, Boolean throwOnValidationError)\r\n   at PX.Api.ContractBased.SystemContracts.V2.RestController.PutEntity(EntityImpl entity, String select, String filter, String expand, String custom)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()"

}

icon

Best answer by Naveen Boga 22 December 2021, 04:54

View original

3 replies

Userlevel 7
Badge +18

Hi @Nicholas Wood  Yes, When I changed Opportunity Numbering sequence to MANUAL, then I got above issue. Attached screenshot for your reference.

 

@Naveen B could you please confirm if you encounter this error when Opportunity numbering is set to manual?

Userlevel 7
Badge +18

Hi @Shaify  I have verified in the newly created instance and I can able create the multiple Opportunities with the above API request.

Added API request, which I have tested in my local machine.

URL: http://localhost/NewInstanceR1/entity/Default/18.200.001/Opportunity

{
"BusinessAccount": {
"value": "AACUSTOMER"
},
"ClassID": {
"value": "PRODUCT"
},
"ConvertedLeadDisplayName": {},
"ConvertedLeadID": {},

"CurrencyViewState": {
"value": false
},
"Details": {},
"Discount": {
"value": 0
},
"Location": {
"value": "MAIN"
},
"ManualAmount": {
"value": false
},
"OpportunityID": {
"value": "E1223"
},
//"Override": {
// "value": true
//},
"Owner": {},
"OwnerEmployeeName": {},
"ParentAccount": {},
"Reason": {
"value": "In Process"
},
"Source": {},
"SourceCampaign": {},
"Stage": {
"value": "Prospect"
},
"Status": {
"value": "Open"
},
"Subject": {
"value": "Test2"
},
"TaxZone": {},
"WeightTotal": {
"value": 0
},
"WorkgroupDescription": {},
"WorkgroupID": {},
"custom": {},
"files": []
}

 

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