Skip to main content

When I update a field on screen CA.30.40.00 (screenshot below), I want it to update in other screens such as CA.30.30.00. I have attached a screenshot of my code to be able to edit those fields after status becomes “released”. Does anyone have any idea what additional steps are needed to refresh the fields on CA.30.30.00 as they are updated elsewhere? Which screen do I have to modify the code in?

 

 

The description field on the Cash Transactions screen is CAAdj.TranDesc.

When you release that document is posts, among other places, to CATran.

The description you see in Cash Account Details is being pulled from CATran.TranDesc

So you’ll need to write the code to update the CATran record along with the CAAdj record when the document’s status is Released.

You might have to do that with a call to PXDatabase.Update


The issue is that we are updating that field after the document is already released. We would need to have the field be updated on all screens when we update the field/hit save. 


So you’re likely going to want to override the Persist method of CATranEntry so that you can add additional logic to the Persisting process. You’ll want to add conditional logic that if the document’s status is already Released and that the user is just updating the description field then you’ll update the relevant transactions where that description is being pulled from.

You’ll need to do some research on where you’re seeing that description appear and then figure out what table/field it is being stored in. I suspect that once you update CATran that most other places will reflect the change but I don’t know that for sure.

PXDatabase.Update allows you to update tables in the database, even on posted transactions.


Hi @rmarschall,

I recommend the following approach:

  1. Extend the CATranEnq graph:
    You can override the Persist method as shown below:

    public delegate void PersistDelegate();
    >PXOverride]
    public void Persist(PersistDelegate baseMethod)
    {
    baseMethod();
    }

     

  2. Create a BQL query:
    Use a BQL query to fetch the cash transaction that matches both the cash account and the transaction reference number with the originating document number.

  3. Pass the description field:
    Once you have the result from the BQL query, assign the description field from the queried object.

Hope, it helps!


It feels like you’re confusing making field editable and automatically updating the field.

You use SetEnabled to make the field editable for user from the screen. But to change the value of the record, you don’t need to change field configuration on any screen.

Create a BQL query to find the record you need to update, and then just update this record like that:

desiredRecord.desiredProperty = description;

If you want field at the CA.30.30.00 to be updated every time field at the CA.30.40.00 is updated, I’d recommend using FieldUpdated event. RowSelected is triggered too often, so your code will do a lot of redundant changes all the time, which will slow the system more than the FieldUpdated. You might also consider adding additional if checks at the top of the event to make sure you propagate the description to child entities only when it’s necessary.

All you need to find - which DACs you should modify. To do that, you can open the screens where the records you want to change are visible, and then in the right top corner of the screen, click Customizations → Inspect Element and the click at the header of the grid for the desired column.


Ended up changing up some of the code with some help from ChatGPT. Was able to get this to update in both tables (realized that it was in 2 spots) and added extra logic in the code. Your comments helped steer me in the right direction though. Thank you all!


Reply