Skip to main content
Question

Custom Long Operation on Sales Order disables Shipping_Contact Fields

  • 4 September 2024
  • 5 replies
  • 51 views

Forum|alt.badge.img+1

Hello,

I have a custom long run in a IEnumerable action and upon return, the Shipping_Contact fields return as disabled. Currently, I have to manually cancel the order to re-enable them- see below for my code:

public PXAction<SOOrder> CustomAction;
[PXProcessButton(CommitChanges = true, Category = "Processing", DisplayOnMainToolbar = true, Connotation = PX.Data.WorkflowAPI.ActionConnotation.Success)]
[PXUIField(DisplayName = "Custom Action", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
public virtual IEnumerable customAction(PXAdapter adapter)
{

List<SOOrder> list = new List<SOOrder>() { Base.Document.Current };

Base.Persist();

PXLongOperation.StartOperation(Base, delegate (){ /*Logic*/ });

return list;

}

To say I tried it.. I have tried adding Base.Cancel.Press(), Base.Shipping_Contact.View.RequestRefresh(); right before returning the list but as I expected, this does not work. I figure this is because the IEnumerable return overrides anything I would do to the screen and it is just returning the current order by the keys.. this is build 23.117.0021.

This is the value before:


This is the value after:


Please let me know if there is anything I am doing wrong or some logic I can tap into to prevent this from happening.
 

5 replies

darylbowman
Captain II
Forum|alt.badge.img+13

Have you tried returning adapter.Get()? Not sure that would make any difference, but maybe worth a shot.


Forum|alt.badge.img+1
  • Author
  • Varsity III
  • 64 replies
  • September 5, 2024

Hey @darylbowman- I did try that as well to no avail.


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2640 replies
  • October 2, 2024

Hi @rhooper91 were you able to find a solution? Thank you!


hdussa
Jr Varsity I
Forum|alt.badge.img
  • Jr Varsity I
  • 75 replies
  • October 4, 2024

Hello @rhooper91 ,

I am late to this discussion. Please try the below code if you still need it. I tested it locally and worked for me and no effect on the Address panel after processing.

public PXAction<SOOrder> CustomAction;
[PXUIField(DisplayName = "Custom Action", MapEnableRights = PXCacheRights.Select)]        
[PXProcessButton(Category = "Processing", DisplayOnMainToolbar = true, Connotation = PX.Data.WorkflowAPI.ActionConnotation.Success)]
protected virtual IEnumerable customAction(PXAdapter adapter)
{
    List<SOOrder> list = adapter.Get<SOOrder>().ToList();
    Base.Save.Press();
    var currentDoc = Base.Document.Current;

    PXLongOperation.StartOperation(Base, () =>
    {
        /* Code Here*/
    });

    return list;
}

 


Forum|alt.badge.img+1
  • Author
  • Varsity III
  • 64 replies
  • October 16, 2024

Hey @hdussa -

I appreciate the insight. I just had a moment to crack the code back open and try your suggestion- replacing the save action with the ui effective save and putting it in a different place in the code and I still get the same thing. I am calling .Persist() in my long run operation due to allocation reasons (I have to delete lines and persist to allow for creating new ones w/ allocated quantities) so that might have something to do with it. Right now, my work around is to just press β€˜Cancel’ and it re-opens.. so not a big deal.. but kind of annoying.

I will reach out if I have an a-ha moment.


Reply


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