Skip to main content
Question

Removing hold from AP Bill via webservice API throwing error

  • October 11, 2023
  • 6 replies
  • 173 views

Forum|alt.badge.img

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

RohitRattan88
Acumatica Moderator
Forum|alt.badge.img+4
  • Acumatica Moderator
  • October 11, 2023

@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.


VladS
Community Manager
Forum|alt.badge.img
  • Community Manager
  • October 11, 2023

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!


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • October 11, 2023

@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.


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • October 11, 2023

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.


Forum|alt.badge.img+8
  • Semi-Pro I
  • October 11, 2023

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
},

Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • October 11, 2023

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.