Skip to main content
Answer

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

  • March 21, 2023
  • 2 replies
  • 481 views

Forum|alt.badge.img+1

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.

  

Best answer by aaghaei

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

2 replies

aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • Answer
  • March 21, 2023

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


Forum|alt.badge.img+1

It worked nicely. Thank you so much @aaghaei .