Skip to main content

Hi, 

I am trying to Release Purchase Receipt Programatically 

At Other Acumatica systems this request worked

URL : https://arts.acumatica.com/(W(1))/entity/ARTSAlphaEndpoint/18.200.001/PurchaseReceipt/ReleasePurchaseReceipt

BODY : 

{

  "entity": {

    "VendorId": {

      "value": "AKA"

    },

 

    "Type": {

      "value": "Normal"

    },         

    "PostPeriod": {

      "value": "04-2019"

    },

    "VendorRef": {

      "value": "998"

    },

     "Location": {

      "value": "MAIN"

    },

    "ReceiptNbr": {

      "value": "PR001126"

    }

  },

 

  "parameters": {}

}

But for our new client it is not working and give the following error : 

"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.Soap.SoapFacadeBase.InvokeImpl(EntityImpl entity, ActionImpl action, Boolean throwOnError)\r\n   at PX.Api.ContractBased.SystemContracts.V4.Facade.PX.Api.ContractBased.IRestGate.Invoke(EntityImpl entity, ActionImpl action, String objectName, HttpRequestMessage request)\r\n   at PX.Api.ContractBased.SystemContracts.V2.RestController.InvokeAction(String objectName, String actionName, ActionInvocation invocation)\r\n   at lambda_method(Closure , Object , Objectp] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Objectd] 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()",

    "innerException": {

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

        "exceptionMessage": "The Release button is disabled.",

        "exceptionType": "PX.Data.PXActionDisabledException",

        "stackTrace": "   at PX.Data.PXAction`1.<Press>d__38.MoveNext()\r\n   at PX.Api.SyImportProcessor.SyStep.PressButton(PXAction button, PXAdapter adapter, SyView view, String actionName, Objecth] currents)\r\n   at PX.Api.SyImportProcessor.SyStep.CommitChangesInt(Object itemToBypass, PXFilterRowp] targetConditions, PXFilterRowÂ] filtersForAction, SyImportRowResult importResult)\r\n   at PX.Api.SyImportProcessor.SyStep.CommitChanges(Object& itemToBypass, PXFilterRow ] targetConditions, PXFilterRowi] filtersForAction)\r\n   at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable()"

    }

Maybe some permissions or configuration must be modified. Please, let me know what can cause such error

Hi @Ivan ,

Could you please try with the below request?

 

{

    "entity": {

        "ReceiptNbr": {

            "value": "PR002024"

        },

        "Type": {

            "value": "Receipt"

        }

    },

    "parameters": {}

}

url: entity/Default/20.200.001/PurchaseReceipt/ReleasePurchaseReceipt
Method: Post

I suspect the “Type“ you are using in the request.


The error message you're encountering, specifically "The Release button is disabled.", indicates that the action you're trying to perform programmatically is not available in the context of the given record or user permissions. This could be due to a variety of reasons, such as the status of the purchase receipt, configuration settings within the system, or the permissions assigned to the user account under which the API call is being made. Here are several steps you can take to troubleshoot and resolve this issue:

  1. Check Purchase Receipt Status and Type: Verify that the Purchase Receipt (PR001126) is in a status that allows it to be released. For example, it may need to be in an 'Open' status rather than 'Closed' or 'Released'. The status might be preventing the release action from being available.

    As mentioned by @jinin Yes, changing the "Type" value from "Normal" to "Receipt" could potentially resolve the issue, especially if the API or the specific operation in Acumatica expects a certain type of document or transaction to perform actions on. The value you set for the "Type" field should align with the expected values.  However, Jinin also uses a different endpoint version that may or may not align with your needs (But I suspect it would be a good time to start using version 20+)

  2. User Permissions: Ensure that the user account used for the API call has sufficient permissions to perform the release action on purchase receipts. You might need to adjust the role or permissions of this user within Acumatica to allow this operation.

  3. Configuration Settings: Review any relevant configuration settings in Acumatica that might affect the availability of the 'Release' button for purchase receipts. There could be workflow or business logic settings that are preventing the action from being executed under certain conditions.

  4. Review Customization Projects: If your Acumatica instance is customized, check any customization projects that might affect purchase receipts or the actions available on them. A customization could be altering the behavior of the 'Release' action or the conditions under which it is enabled.

  5. API Version Compatibility: Ensure that the API endpoint and payload structure you're using are compatible with the version of Acumatica your client is running. If you’re using a different version than your previous successful attempts with other systems, there may have been changes to the API that affect how actions like 'ReleasePurchaseReceipt' are handled.  Specifically the deprication of the contract API for versions 17 and 18. You could try using 20+ for this and testing it again. 


Hi @Ivan ,

Could you please try with the below request?

 

{

    "entity": {

        "ReceiptNbr": {

            "value": "PR002024"

        },

        "Type": {

            "value": "Receipt"

        }

    },

    "parameters": {}

}

url: entity/Default/20.200.001/PurchaseReceipt/ReleasePurchaseReceipt
Method: Post

I suspect the “Type“ you are using in the request.

Thank you


Reply