Question

Removing hold from AP Bill via webservice API throwing error

  • 11 October 2023
  • 6 replies
  • 72 views

Userlevel 2
Badge

Hi,

I wanted to remove “Hold” from AP Bills through webservice API by calling following code and it is throwing an error “The Remove Hold button is disabled” but in actual the button is not disabled and I can remove hold manually on UI without any error. any one knows what is wrong with the code?

 

static MyWebservice.Screen context = new Screen();

context.AP301000Clear();
                        var commands = new List<Command>
                        {
                            // Header Info
                            new Key { Value = "='" + dr["ReferenceNbr"].ToString() + "'", FieldName =
                                APBill.DocumentSummary.ReferenceNbr.FieldName, ObjectName =
                                APBill.DocumentSummary.ReferenceNbr.ObjectName }             
                        };

                        commands.Add(APBill.Actions.ReleaseFromHold);

 

var poResults = context.AP301000Submit(commands.ToArray());

 

 

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> PX.Data.PXActionDisabledException: Error: The Remove Hold button is disabled.
   at PX.Data.PXAction`1.<Press>d__33.MoveNext()
   at PX.Api.SyImportProcessor.SyStep.PressButton(PXAction button, PXAdapter adapter, SyView view, String actionName, Object[] currents)
   at PX.Api.SyImportProcessor.SyStep.CommitChangesInt(Object itemToBypass, PXFilterRow[] targetConditions, PXFilterRow[] filtersForAction, SyImportRowResult importResult)
   at PX.Api.SyImportProcessor.SyStep.CommitChanges(Object& itemToBypass, PXFilterRow[] targetConditions, PXFilterRow[] filtersForAction)
   at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable()
   at PX.Api.ScreenUtils.Submit(String screenId, IReadOnlyList`1 commands, SchemaMode schemaMode, PXGraph& graph, String& redirectContainerView, String& redirectScreen, Boolean mobile, Dictionary`2 viewFilters, IGraphHelper graphHelper)
   at PX.Api.Services.ScreenService.Submit(String id, IEnumerable`1 commands, SchemaMode schemaMode, Boolean mobile, PXGraph& forceGraph, String& redirectContainerView, String& redirectScreen, Dictionary`2 viewFilters, IGraphHelper graphHelper)
   at PX.Api.Services.ScreenService.Submit(String id, IEnumerable`1 commands, SchemaMode schemaMode)
   at PX.Api.Soap.Screen.ScreenGate.Submit(Command[] commands)
   --- End of inner exception stack trace ---


6 replies

Userlevel 7
Badge +4

@adilaleem from the error message, “The Remove Hold button is disabled

Please review the state of Bill in UI and make sure you are able to remove it from  HOLD from UI first.

Userlevel 3
Badge

Hello @adilaleem !

To build off @RohitRattan88 , I would definitely see what is required to be able to push the “Remove Hold” button in the UI before attempting to use the API. It’s possible that there is a required field or value that needs to be put in place before the logic of the button will work. For example maybe the button relies on a reference number, a selected document, etc…

Let me know if you have any questions, thanks!

Userlevel 2
Badge

@adilaleem from the error message, “The Remove Hold button is disabled

Please review the state of Bill in UI and make sure you are able to remove it from  HOLD from UI first.

Hi Rohit,

yes I was able to remove hold from UI without any error.

Userlevel 2
Badge

Hello @adilaleem !

To build off @RohitRattan88 , I would definitely see what is required to be able to push the “Remove Hold” button in the UI before attempting to use the API. It’s possible that there is a required field or value that needs to be put in place before the logic of the button will work. For example maybe the button relies on a reference number, a selected document, etc…

Let me know if you have any questions, thanks!

Hi Sushkin,

I provided the reference number already. what else I should provide? should I provide all the mandatory fields I’m seeing at UI? how to check what mandatory fields are required for a specific action? btw when I call Save action with a field update on the same bill by providing only reference number, it works that's mean the code is able to hit the correct bill I wanted to update.

Userlevel 7
Badge +9

Hi @adilaleem In your instance, the same reference number might be shared between types Bill, Debit Adjustments and Credit Adjustments.

Try adding the Type to your code like below sample:

new Value {
Value = "Bill", LinkedCommand = AP301000Header.DocumentSummary.Type
},
Userlevel 2
Badge

Hi @adilaleem In your instance, the same reference number might be shared between types Bill, Debit Adjustments and Credit Adjustments.

Try adding the Type to your code like below sample:

new Value {
Value = "Bill", LinkedCommand = AP301000Header.DocumentSummary.Type
},

Hi Chandra,

thanks for your reply. I also tried that but didn’t work and throwing the same error.

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