Skip to main content
Question

Project Transaction header custom field editable after release


lbarker
Varsity II
Forum|alt.badge.img+1

I have added a custom field on the header of the Project Transaction screen, but I need this to be editable when the transaction is released.

This screen has no workflow, so wondering if anyone can assist with how to do this please.

Its all enabled, and I can update it on screen, but when I press save, it loses the data / does not actually save it to the PMRegister table.

10 replies

Forum|alt.badge.img+7
  • Captain II
  • 295 replies
  • September 10, 2024

Hi @lbarker 

 

You could use something like this for the visibility:

protected virtual void _(Events.RowSelected<PMRegister> e, PXRowSelected b)

b?.Invoke(e.Cache, e.Args);

if(row.Status == “R”)

{

PXUIFieldAttribute.SetEnabled<PMRegister.UsrCustomField>(e.Cache, e.Row, false);

}

For persisting, is there a database script for this field?

 

Aleks


Nilkanth Dipak
Jr Varsity III
Forum|alt.badge.img+7
  • Jr Varsity III
  • 308 replies
  • September 10, 2024

Hi @lbarker,

 

Could you please try below code snippet?  Please replace usrTest field with your custom field.

 protected void PMRegister_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
 {
     var row = (PMRegister)e.Row;
     if (row == null) return;

     // Allow the custom field to be editable even after release
     PMRegisterExt rowExt = cache.GetExtension<PMRegisterExt>(row);

     if (row.Released == true)
     {
         cache.AllowUpdate = true; // Allow updates on released records
         PXUIFieldAttribute.SetEnabled<PMRegisterExt.usrTest>(cache, row, true);
     }
 }

Hope, it helps!

 


lbarker
Varsity II
Forum|alt.badge.img+1
  • Author
  • Varsity II
  • 75 replies
  • September 16, 2024

Thanks for the help but sadly same issue. 

Its enabled, and press Save action works on screen, but the data does not actually save to the custom field if the record is flagged as released.

 


Nilkanth Dipak
Jr Varsity III
Forum|alt.badge.img+7
  • Jr Varsity III
  • 308 replies
  • September 16, 2024

Hi @lbarker ,

Could you please confirm Is the custom field is DB field? 

Please provide your custom field code, how you have declared at DAC level?


lbarker
Varsity II
Forum|alt.badge.img+1
  • Author
  • Varsity II
  • 75 replies
  • September 17, 2024

Yes I added it to the DB under Database Scripts and have not changed the attributes using Data Class.

Can use it if the transaction is not released so its saving only in that instance


Forum|alt.badge.img+7
  • Captain II
  • 295 replies
  • September 17, 2024

Hi @lbarker 

 

Have you tried something like this:

protected virtual void _(Events.RowSelected<PMRegister> e, PXRowSelected b)

b?.Invoke(e.Cache, e.Args);

PMRegisterExt rowExt = row.GetExtension<PMRegisterExt>;

if(row.Status == “R”)

{

//Sets the field as enabled

PXUIFieldAttribute.SetEnabled<PMRegisterExt.UsrCustomField>(e.Cache, e.Row, true);

//Sets the field as visible

PXUIFieldAttribute.SetVisible<PMRegisterExt.UsrCustomField>(e.Cache, e.Row, true);

}

You will have to do this in a Graph extension for the graph responsible for the screen you are using.

 

For the field not saving, you can try directly removing it completely, publishing the customisation project, then adding it from the screen editor, it creates a DAC extension and a DB script to ensure that the field persists, publishing the project to make the field available, then adding the field to the screen where you want it, then publish again with the graph extension. 

 

To find the graph, press ctrl + alt on a field and this will come up:

you want to create a code file, type of graph extension, and select the graph named in the ‘Business Logic’ field.

Aleks


darylbowman
Captain II
Forum|alt.badge.img+13
  • 1608 replies
  • September 17, 2024

It would be helpful to see your field definition.


lbarker
Varsity II
Forum|alt.badge.img+1
  • Author
  • Varsity II
  • 75 replies
  • September 23, 2024

Yeh the field is fine and is in the database,  as can edit it no problem and save it from add record point to release point.

For released records we want to be able to edit it and save it.

Its only when the record is flagged as released, we can edit it, but after pressing save its actually not saved to the data.


hdussa
Jr Varsity I
Forum|alt.badge.img
  • Jr Varsity I
  • 75 replies
  • September 24, 2024

Hello @lbarker ,

 

It is likely that the Cache is not updated with the value to save to the DB after release. Assuming there is a Field Updated event on the custom field, try the below line of code that forces the Cache to consider the modified records to persist. Make sure the CommitChanges property of the custom field is set to TRUE as well.

var doc = Caches[typeof(TPrimary)].Current;
Caches[typeof(TPrimary)].MarkUpdated(doc);

 


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

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


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