Skip to main content
Solved

Update expiration date on a receipt with a lotted item

  • October 22, 2024
  • 1 reply
  • 40 views

Forum|alt.badge.img

Hello Community, 

I have a customization created that is enabling the InTranSplit.expireDate field in the IN > Receipts screen on released documents. This allows me to update the expiration date on the table which works just fine. However, the lot\serial report pulls from INSiteLotSerial table which doesn’t update using this method. Is there something else I need to call to get this extra table updated or is it just a bad idea to update the expiration date this way? Should I instead create a processing screen that instead generates a copy of this receipt and one line to adjust it out and another to adjust it in with a new date?

  public class INReceiptEntry_Extension : PXGraphExtension<PX.Objects.IN.INReceiptEntry>
  {
    #region Event Handlers
    protected void INTranSplit_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
    {
      InvokeBaseHandler?.Invoke(cache, e);
      var row = (INTranSplit)e.Row;
      if (row != null)
      {
        Base.CurrentDocument.Cache.AllowUpdate = true;
        Base.transactions.Cache.AllowUpdate = true;
        Base.splits.Cache.AllowUpdate = true;
        PXUIFieldAttribute.SetEnabled<INTranSplit.expireDate>(cache, row, true);
        Base.transactions.Current.ExpireDate = row.ExpireDate;
        Base.transactions.UpdateCurrent();
      }
    }
    #endregion
  }

Thanks,

Adam

Best answer by Django

You can update anything you want. Just do it carefully and without breaking stuff.

The code to enable the fields is in the correct event but I don’t think you want your update code within the _RowSelected event. That event is called many many times and updating the record could send you into a loop.

Depending on your requirements, if you’re only updating one date at a time for the whole line (with all the splits), or even just for a single split, Keith Richardson has a great video on doing updates on posted documents with a smart panel to ask for the new value and an action button. That, right away, gives you full control over the update logic and it allows you to secure access to that functionality if not everyone should have rights to change those values.

https://www.youtube.com/watch?v=Knp723AFQII

 

View original
Did this topic help you find an answer to your question?

1 reply

Forum|alt.badge.img+6
  • Captain II
  • 561 replies
  • Answer
  • October 22, 2024

You can update anything you want. Just do it carefully and without breaking stuff.

The code to enable the fields is in the correct event but I don’t think you want your update code within the _RowSelected event. That event is called many many times and updating the record could send you into a loop.

Depending on your requirements, if you’re only updating one date at a time for the whole line (with all the splits), or even just for a single split, Keith Richardson has a great video on doing updates on posted documents with a smart panel to ask for the new value and an action button. That, right away, gives you full control over the update logic and it allows you to secure access to that functionality if not everyone should have rights to change those values.

https://www.youtube.com/watch?v=Knp723AFQII

 


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