Skip to main content
Solved

REST API: Suppress Warning(s)

  • January 16, 2025
  • 4 replies
  • 75 views

Forum|alt.badge.img

I want to use the Default/Shipment API to create a shipment for a sales order line that isn’t due to ship yet. In the UI, this produces a warning on the SO line saying “Scheduled Shipment Date greater than Shipment Date”. See this topic for a description of the behavior:

When this request is sent via API instead, the warning prevents the Shipment from being created. Is there a way to overcome this warning and save the Shipment anyway like you can in the UI?

Best answer by Dmitrii Naumov

@PBSA the only workaround I found is to create the shipment for the later date and then update the shipment date to what you need.

4 replies

Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • January 17, 2025

@PBSA  could you please share an example of the API request? 

 


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • January 17, 2025

@Dmitrii Naumov  Of course:

The Sales Order is Requested on Jan 31 (the line is also):
 

 

Here is the PUT request (to /entity/Default/23.200.001/Shipment):

{
"Type": {
"value": "I"
},
"CustomerID": {
"value": "AACOMPUTER01"
},
"Location": {
"value": "MAIN"
},
"WarehouseID": {
"value": "PBNW"
},
"Operation": {
"value": "Issue"
},
"ShipmentDate": {
"value": "2024-01-17"
},
"Details": [
{
"OrderType":{"value":"SO"},
"OrderNbr":{"value":"180044"},
"OrderLineNbr":{"value":"1"},
"ShippedQty":{"value":1},
"Allocations":[{
"InventoryID":{"value":"011706"},
"LocationID":{"value":"P:25000067"},
"LotSerialNbr":{"value":""},
"Qty":{"value":"1"},
"UOM":{"value":"EA"}
}]
}
]
}

And the response:
 

{
"message": "An error has occurred.",
"exceptionMessage": "Operation failed",
"exceptionType": "PX.Data.PXInvalidOperationException",
"stackTrace": " at PX.Api.ContractBased.EntityService.Put(ISystemContract systemContract, String version, String name, EntityImpl entity, CbOperationContext operationContext, Boolean throwOnError)\r\n at PX.Api.ContractBased.AspNetCore.CbEndpointFeatureServiceExtensions.Put(IEntityService entityService, ICbEndpointFeature feature, EntityImpl entity, CbOperationContext operationContext)\r\n at PX.Api.ContractBased.WebApi.Controllers.EntityController.PutEntity(EntityImpl entity, String select, String filter, String expand, String custom)\r\n at lambda_method(Closure , Object , Object[] )\r\n at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.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 Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.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 Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)\r\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__13.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 Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextExceptionFilterAsync>d__24.MoveNext()",
"innerException": {
"message": "An error has occurred.",
"exceptionMessage": "Exception has been thrown by the target of an invocation.",
"exceptionType": "System.Reflection.TargetInvocationException",
"stackTrace": " at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)\r\n at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)\r\n at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n at PX.Api.ContractBased.EntityExportContextBuilder.<>c__DisplayClass91_1.<FindImplementations>b__3(PXGraph graph, EntityImpl entity, EntityImpl targetEntity)\r\n at PX.Api.SyImportProcessor.SyStep.ProcessLocateByNoteIdCommand(SyCommand cmd, SyView view, Boolean invokeCommand) in C:\\build\\code_repo\\NetTools\\PX.Data\\Api\\Export\\SyImport\\ImportProcessor.cs:line 2806\r\n at PX.Api.SyImportProcessor.SyStep.ProcessCommand(SyCommand cmd, Boolean& needCommit) in C:\\build\\code_repo\\NetTools\\PX.Data\\Api\\Export\\SyImport\\ImportProcessor.cs:line 2793\r\n at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable(CancellationToken token) in C:\\build\\code_repo\\NetTools\\PX.Data\\Api\\Export\\SyImport\\ImportProcessor.cs:line 1386",
"innerException": {
"message": "An error has occurred.",
"exceptionMessage": "PlanDate: Scheduled Shipment Date greater than Shipment Date",
"exceptionType": "System.InvalidOperationException",
"stackTrace": " at PX.Objects.DefaultEndpointImpl.AssertNoErrors(PXCache cache, Object current) in C:\\build\\code_repo\\WebSites\\Pure\\PX.Objects\\EndpointAdapters\\DefaultEndpointImpl.cs:line 246\r\n at PX.Objects.DefaultEndpointImpl.SelectLine(SOShipmentEntry shipmentEntry, SOShipmentPlan item) in C:\\build\\code_repo\\WebSites\\Pure\\PX.Objects\\EndpointAdapters\\DefaultEndpointImpl.cs:line 236\r\n at PX.Objects.DefaultEndpointImpl.ShipmentDetail_Insert(PXGraph graph, EntityImpl entity, EntityImpl targetEntity) in C:\\build\\code_repo\\WebSites\\Pure\\PX.Objects\\EndpointAdapters\\DefaultEndpointImpl.cs:line 156"
}
}
}

But if I try in the UI, it is a warning:

Thank you for reading.


Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • Answer
  • January 19, 2025

@PBSA the only workaround I found is to create the shipment for the later date and then update the shipment date to what you need.


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • January 20, 2025

@Dmitrii Naumov Thank you for the suggestion, that does work for this situation. Hopefully if there is some method of preemptively addressing a warning in an API request (more generally), someone will mention it here.