For persisting, is there a database script for this field?
Aleks
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!
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.
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?
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
Hi @lbarker
Have you tried something like this:
protected virtual void _(Events.RowSelected<PMRegister> e, PXRowSelected b)
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
It would be helpful to see your field definition.
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.
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 = Cachesetypeof(TPrimary)].Current; Cachesetypeof(TPrimary)].MarkUpdated(doc);