Skip to main content
Question

Confirmation box on Remove hold


Forum|alt.badge.img

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 ?

7 replies

Sagar Greytrix
Captain II
Forum|alt.badge.img+3

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


Forum|alt.badge.img
  • Author
  • Freshman I
  • 21 replies
  • January 11, 2024
sagar07 wrote:

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 ?

 


Sagar Greytrix
Captain II
Forum|alt.badge.img+3

Hi @ifelix,

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

Hope, it helps!

Regards,

Sagar

 

 


Forum|alt.badge.img
  • Author
  • Freshman I
  • 21 replies
  • January 11, 2024
sagar07 wrote:

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?)

 


Sagar Greytrix
Captain II
Forum|alt.badge.img+3

Hi @ifelix ,

  Base.Document.Cache.IsDirty = true;

Should be work.

Regards,

Sagar


Forum|alt.badge.img+1

Hi ​@ifelix , Please check this. Here is the correct way.

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

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

				}	
			}
          return baseMethod(adapter);
    }

 


Forum|alt.badge.img+8
  • Captain II
  • 379 replies
  • April 3, 2025

Hi ​@ifelix 

 

Have you tried doing this using the workflow engine? I believe you can achieve it with no code.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings