Question

Confirmation box on Remove hold

  • 10 January 2024
  • 5 replies
  • 75 views

Userlevel 1
Badge

Hi. I’m trying to include a confirmation message box with yes no on Remove Hold action button. If click yes then i want to change the status of the Remove hold. If click no then nothing should change. Here’s is my code.

 public delegate IEnumerable ReleaseFromHoldDelegate(PXAdapter adapter);
[PXOverride]
public IEnumerable ReleaseFromHold(PXAdapter adapter, ReleaseFromHoldDelegate baseMethod)
{
ARInvoice row = Base.Document.Current;

if(row.CustomerID != null &&
Base.Document.Ask("Are you sure you want to remove hold this?", MessageButtons.YesNo)
!= WebDialogResult.Yes) return adapter.Get();

return baseMethod(adapter);
}

When i click either yes or no in the confirmation box it gives me an error like this:

 

How can i solve this please ?


5 replies

Userlevel 5
Badge +1

Hi @ifelix,

could you please try below code..

I have not tried it but hope it works for you.

public delegate IEnumerable ReleaseFromHoldDelegate(PXAdapter adapter);

[PXOverride]
public IEnumerable ReleaseFromHold(PXAdapter adapter, ReleaseFromHoldDelegate baseMethod)
{
ARInvoice row = Base.Document.Current;

if (row.CustomerID != null &&
Base.Document.Ask("Are you sure you want to remove hold from this?", MessageButtons.YesNo)
!= WebDialogResult.Yes)
{
Base.IsDirty = true; //set IsDirty to true
return adapter.Get();
}

return baseMethod(adapter);
}

Regards,

Sagar

Userlevel 1
Badge

Hi @ifelix,

could you please try below code..

I have not tried it but hope it works for you.

public delegate IEnumerable ReleaseFromHoldDelegate(PXAdapter adapter);

[PXOverride]
public IEnumerable ReleaseFromHold(PXAdapter adapter, ReleaseFromHoldDelegate baseMethod)
{
ARInvoice row = Base.Document.Current;

if (row.CustomerID != null &&
Base.Document.Ask("Are you sure you want to remove hold from this?", MessageButtons.YesNo)
!= WebDialogResult.Yes)
{
Base.IsDirty = true; //set IsDirty to true
return adapter.Get();
}

return baseMethod(adapter);
}

Regards,

Sagar

Hi there. When i apply this code i get an error like this one. Any idea why ?

 

Userlevel 5
Badge +1

Hi @ifelix,

Could you please replace Base.IsDirty = true; to  row.cache.IsDirty = true;

Hope, it helps!

Regards,

Sagar

 

 

Userlevel 1
Badge

Hi @ifelix,

Could you please replace Base.IsDirty = true; to  row.cache.IsDirty = true;?

Hope, it helps!

Regards,

Sagar

 

Hi@sagar07 ,

And it says something like this:

\App_RuntimeCode\SOInvoiceEntry.cs(89): error CS1061: 'ARInvoice' does not contain a definition for 'cache' and no accessible extension method 'cache' accepting a first argument of type 'ARInvoice' could be found (are you missing a using directive or an assembly reference?)

 

Userlevel 5
Badge +1

Hi @ifelix ,

  Base.Document.Cache.IsDirty = true;

Should be work.

Regards,

Sagar

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