Skip to main content
Solved

How to set up a field is required when it meets specific condition?


Forum|alt.badge.img
  • Jr Varsity II
  • 34 replies

Hi All, 

I want to set up the required input project if the warehouse is "PENDING."

I set it up like below, but it's not working; even if the field Project is marked with an asterisk or star, the system still allows it to save.

Please advise where I am wrong

 

 

Best answer by Nilkanth Dipak

Hi @dilys,

If above approaches does not work, you need to throw PXException on row persisting event.

e.g.

protected void RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
        {
            if (e.Row == null) return;
            var row = e.Row;
            if (row.siteID == "PEDNING")
            {
                    throw new Exception("Project is Required");

            }
        }

If you are not familiar with customization, This link can be push you into right direction to get desired result.

View original
Did this topic help you find an answer to your question?

5 replies

DavidEichner
Captain II
Forum|alt.badge.img+13
  • Captain II
  • 372 replies
  • April 3, 2024

Hi @dilys 

You have a couple of options.  First, you could start a support case with either your partner or Acumatica directly to confirm if it is a bug.  This would let Acumatica know about the issue quicker so it can be resolved in a future build.

Second, you or your partner could write a customization package (or hire a developer) to override Acumatica code to make it work.

Best,

 

David

 


Nilkanth Dipak
Semi-Pro I
Forum|alt.badge.img+10

Hi @dilys,

Have you tried to set the CommitChanges = true for Warehouse ID field?

Also I believe you need to set Repaint Columns = true for the Location table grid which refreshes the grid.

If above solution does not works then you need to do customization(code) to works it as expected.


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 34 replies
  • May 6, 2024
Dipak Nilkanth wrote:

Hi @dilys,

Have you tried to set the CommitChanges = true for Warehouse ID field?

Also I believe you need to set Repaint Columns = true for the Location table grid which refreshes the grid.

If above solution does not works then you need to do customization(code) to works it as expected.

I tried the way you told me, but it’s still the same, do you have any idea?

 


Nilkanth Dipak
Semi-Pro I
Forum|alt.badge.img+10

Hi @dilys,

If above approaches does not work, you need to throw PXException on row persisting event.

e.g.

protected void RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
        {
            if (e.Row == null) return;
            var row = e.Row;
            if (row.siteID == "PEDNING")
            {
                    throw new Exception("Project is Required");

            }
        }

If you are not familiar with customization, This link can be push you into right direction to get desired result.


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 34 replies
  • May 6, 2024
Dipak Nilkanth wrote:

Hi @dilys,

If above approaches does not work, you need to throw PXException on row persisting event.

e.g.

protected void RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
        {
            if (e.Row == null) return;
            var row = e.Row;
            if (row.siteID == "PEDNING")
            {
                    throw new Exception("Project is Required");

            }
        }

If you are not familiar with customization, This link can be push you into right direction to get desired result.

Thanks for your help


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