Solved

How to disable editable all fields of an existing reference number?

  • 21 March 2023
  • 2 replies
  • 216 views

Userlevel 4
Badge

Hi,I developed a custom screen as below.

As you can see in the above screen shot, I have already saved some records to the database for the above mentioned reference number. After adding and saving record to the database as above, i need to keep the all fillable fields as non editable.

I tried to accomplish this task by putting the following event handler.

protected void APProforma_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{

var row = (APProforma)e.Row;

APProforma item = SelectFrom<APProforma>.Where<APProforma.refNbr.IsEqual<APProforma.refNbr>>.View.Select(this, row.RefNbr);

if (item.RefNbr != null)
{
//row.Currency = item.RefNbr;
APProformas.AllowInsert = false;
APProformas.AllowSelect = false;
APProformas.AllowDelete = false;
APProformas.AllowUpdate = false;
APProformaItems.AllowInsert = false;
APProformaItems.AllowSelect = false;
APProformaItems.AllowDelete = false;
APProformaItems.AllowUpdate = false;

}
else
{
APProformas.AllowInsert = true;
APProformas.AllowSelect = true;
APProformas.AllowDelete = true;
APProformas.AllowUpdate = true;
APProformaItems.AllowInsert = true;
APProformaItems.AllowSelect = true;
APProformaItems.AllowDelete = true;
APProformaItems.AllowUpdate = true;

}

}

But this time when i’m going to create a record for a new reference number, after filling the reference number field, all the other fields are also becoming non editable at once.

So, can someone help me to solve this issue?

For your reference:

APProforma = DAC for the form view.

APProformas = View for the form view.

APProformaItems = View for the grid of the screen.

  

icon

Best answer by aaghaei 21 March 2023, 17:39

View original

2 replies

Userlevel 7
Badge +9

1) Remove AllowSelect from your code.

2) Also if you have tstamp field in your DAC I suggest you check that to see if it is null or not. You won’t need extra select if you have this filed just directly check if (row.tstamp != Null) if you don’t have I suggest you add it to your custom DAC. Just copy from one of Acumatica DACs. This field as long as data is not saved is null and will be filled when saved. Very reliable in your case

Userlevel 4
Badge

It worked nicely. Thank you so much @aaghaei .

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved