Hi everyone,
I’m currently trying to create an AP Bill from a Purchase Receipt using an API (Postman), but I’m running into an error.
Here are the details:
Endpoint:
POST {{BaseURL}}/entity/Default/23.200.001/PurchaseReceipt/CreateAPBill
Request Body:
{
"entity":
{
"id":
"a256ce42-5b3b-f011-837f-0eddcec71d29"
}
} Response from Postman:
{
"message": "An error has occurred.",
"exceptionMessage": "Operation failed",
"exceptionType": "PX.Data.PXInvalidOperationException",
"stackTrace": " at PX.Api.ContractBased.EntityService.Invoke(ISystemContract systemContract, String version, String name, EntityImpl entity, ActionImpl action, CbOperationContext operationContext, Boolean throwOnError)\r\n at PX.Api.ContractBased.AspNetCore.CbEndpointFeatureServiceExtensions.Invoke(IEntityService entityService, ICbEndpointFeature feature, EntityImpl entity, ActionImpl action, CbOperationContext operationContext)\r\n at PX.Api.ContractBased.WebApi.Controllers.ActionController.InvokeAction(String objectName, String actionName, ActionInvocation invocation)\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": "Enter AP Bill",
"exceptionType": "PX.Data.PXRedirectRequiredException",
"stackTrace": " at PX.Objects.PO.POReceiptEntry.CreateAPDocument(PXAdapter adapter)\r\n at PX.Data.PXAction`1.RunHandler(PXAdapter adapter)\r\n at PX.Data.PXAction`1.<Press>d__39.MoveNext()\r\n at PX.Data.PXAction`1.<Press>d__39.MoveNext()\r\n at PX.Api.SyImportProcessor.SyStep.PressButton(PXAction button, PXAdapter adapter, SyView view, String actionName, Object[] currents)\r\n at PX.Api.SyImportProcessor.SyStep.CommitChangesInt(Object itemToBypass, PXFilterRow[] targetConditions, PXFilterRow[] filtersForAction, SyImportRowResult importResult)\r\n at PX.Api.SyImportProcessor.SyStep.CommitChanges(Object& itemToBypass, PXFilterRow[] targetConditions, PXFilterRow[] filtersForAction)\r\n at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable(CancellationToken token)"
}
}
It seems to be failing with a PXRedirectRequiredException and the message "Enter AP Bill".
I’m following the process shown in this video (minute 48:00):
https://www.youtube.com/watch?v=WZjlfsN6aew
Has anyone tried this before? Do you have any recommendations or examples of a successful implementation of CreateAPBill through the API?
Any help or guidance would be greatly appreciated!
Thank you in advance.
Best regards,
