How do I go about making another field visible depending on the value of another field. I would like to do this with Acumatica Tools as I’m not familiar with Visual Studio.
Make a Combo box visible depending on the value of another field
Can you give some more details, such as the field names and what value would change the visibility?
hi
As
But as a first point of call, this would be a customisation, probably an override of the RowSelected handler, and would look something like this:
protected virtual void _(Events.RowSelected<YourDac> e, PXRowSelectedArgs b)
{
YourDac row = e.Row;
b?.Invoke(e.Cache, e.Args)
if(row.YourField == "SomeValue")
{
PXUIFieldAttribute.SetEnabled<row.YourDropDown>(e.Cache, e.Row, true)
}
}
The solution should be something along these lines.
Some people consider adding fields into Data Access to be low code. Since you can also change / add DAC attributes there, it would probably be possible using [PXUIEnabled], but under the hood, it's still a customization.
Hi. I added a new field using this method.
Custom Field combo box list creation | Community (acumatica.com)
I would like this combo box to be only activated when the status of a customer account is changed to “OnHold”. The user would then be able to select the reason the account is “OnHold”. This field would be made visible on service orders as a quick glance to why the customer account is on hold and the service order cannot be created.
The T210 training does go through this but from a VB perspective.
The best thing you could do is add a dialog box to the workflow transition, that’s no code just through the workflow engine.
I would like this combo box to be only activated when the status of a customer account is changed to “OnHold”. The user would then be able to select the reason the account is “OnHold”.
I’m assuming you’re wanting to set the combo box value from the Customer screen.
This field would be made visible on service orders as a quick glance to why the customer account is on hold and the service order cannot be created.
This may be tricky using low-code / no-code, but I haven’t looked at the screen.
Since you already used DAC attributes in creating the field, simply add this attribute in the same place:
[PXUIEnabled(typeof(Where<Customer.status.IsEqual<CustomerStatus.hold>>))]
If you additionally wish to require the field when the Custom is ‘On Hold’, add these as well:
[PXUIRequired(typeof(Where<Customer.status.IsEqual<CustomerStatus.hold>>))]
[PXDefault]
Finally,
...but from a VB perspective.
Acumatica is written in C#.
You can do this by adding the new even handler. You can do that in your browser without opening Visual Studio.
1. Click Customization at the top right corner
2. Click Inspect element
3. Click on any control at the screen
4. In new popup, click Customize
5. New window will open. It will show you the page where you can edit layout of the screen
6. Click three dots right to the Preview Changes button
7. Click Customize Business Logic
8. New page will be opened, with a template like this:
using System;
using PX.Objects;
using PX.Data;
namespace Sprinterra.CommunityRnd.InquiryTotals
{
public class MSInquiry_Extension : PXGraphExtension<Sprinterra.CommunityRnd.InquiryTotals.MSInquiry>
{
#region Event Handlers
#endregion
}
}
9. Between #region and #endregion lines, insert this code:
public virtual void _(Events.RowSelected<Customer> e, PXRowSelected baseMethod)
{
baseMethod?.Invoke(e.Cache, e.Args);
if (!(e.Row is Customer row))
return;
PXUIFieldAttribute.SetEnabled<Customer.collectionAction>(e.Cache, row, row.Status == "OnHold");
}
10. Replace Customer with the DAC you're trying to track, and "OnHold" with the value associated with the OnHold status.
11. Click Save
12. Click Publish at the top menu
13. Click Publish Current Project
You'll see a new section at the bottom of the page that will show you the progress. Once it's finished - it's done.
If you need help with identifying the right DAC and Status value, tell me the screen you're trying to customize and which Status field you need to check for.
Let me know if there's any issue with this approach.
I'd also want to point out that as
-
@andriitkachenko thanks for your reply. I will also try this method.
How do I clear this field once the status is changed back to “Active” or one of the other status?
You need to add another command to the event:
public virtual void _(Events.RowSelected<Customer> e, PXRowSelected baseMethod)
{
baseMethod?.Invoke(e.Cache, e.Args);
if (!(e.Row is Customer row))
return;
PXUIFieldAttribute.SetEnabled<Customer.collectionAction>(e.Cache, row, row.Status == "OnHold");
if(row.Status=="Active")
row.CollectionAction = null;
}
But, as
Tips & Tricks Using Acumatica's Low-Code/No-Code
You basically create the condition and use it on the Hidden parameter for the field.
You can do this by adding the new even handler. You can do that in your browser without opening Visual Studio.
1. Click Customization at the top right corner
2. Click Inspect element
3. Click on any control at the screen
4. In new popup, click Customize
5. New window will open. It will show you the page where you can edit layout of the screen
6. Click three dots right to the Preview Changes button
7. Click Customize Business Logic
8. New page will be opened, with a template like this:
using System;
using PX.Objects;
using PX.Data;
namespace Sprinterra.CommunityRnd.InquiryTotals
{
public class MSInquiry_Extension : PXGraphExtension<Sprinterra.CommunityRnd.InquiryTotals.MSInquiry>
{
#region Event Handlers
#endregion
}
}
9. Between #region and #endregion lines, insert this code:
public virtual void _(Events.RowSelected<Customer> e, PXRowSelected baseMethod)
{
baseMethod?.Invoke(e.Cache, e.Args);
if (!(e.Row is Customer row))
return;
PXUIFieldAttribute.SetEnabled<Customer.collectionAction>(e.Cache, row, row.Status == "OnHold");
}
10. Replace Customer with the DAC you're trying to track, and "OnHold" with the value associated with the OnHold status.
11. Click Save
12. Click Publish at the top menu
13. Click Publish Current Project
You'll see a new section at the bottom of the page that will show you the progress. Once it's finished - it's done.
If you need help with identifying the right DAC and Status value, tell me the screen you're trying to customize and which Status field you need to check for.
Let me know if there's any issue with this approach.
I'd also want to point out that as
Thanks. I will look into trying it this way also. Would you recommend perusing an understanding of C# and web development as a next step?
The best thing you could do is add a dialog box to the workflow transition, that’s no code just through the workflow engine.
Will take a look. Thanks
Thanks. I will look into trying it this way also. Would you recommend perusing an understanding of C# and web development as a next step?
Depends on your goals and availability.
If you want to go further with the custom logic and cover other cases - then yes, it will start requiring more and more knowledge about the software development.
Whether it’s worth it to learn more or outsource it - is up to you. If you have time and patience to learn how to write a code and develop new things - go for it, you can start with learning only chunks required to your right now.
Otherwise - you can reach out to an ISV to help you make the customization you need.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.