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.