Skip to main content

Disable a field in UI but enable for Import Scenarios

  • September 18, 2024
  • 1 reply
  • 49 views

darylbowman
Captain II
Forum|alt.badge.img+13

Since Import Scenarios usually behave exactly as using the UI would, fields disabled in the UI are normally not able to be imported to.

 

This custom attribute will allow you to specify a field to be disabled for the UI but still allow importing:

public class DXEnableForImportAttribute : PXEventSubscriberAttribute, IPXRowSelectedSubscriber
{
    public DXEnableForImportAttribute() :
        base()
    { }

    public void RowSelected(PXCache cache, PXRowSelectedEventArgs e)
    {
        PXUIFieldAttribute.SetEnabled(cache, e.Row, _FieldName, cache.Graph.IsImport);
    }
}

Then use it:

#region UsrCustomField
[PXDBString(15, IsUnicode = true)]
[DXEnableForImport] // here
[PXUIField(DisplayName = "Custom Field")]
public virtual string UsrCustomField { get; set; }
public abstract class usrCustomField : BqlString.Field<usrCustomField> { }
#endregion

 

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

1 reply

Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2756 replies
  • September 18, 2024

Thank you for sharing this tip with the community @darylbowman!


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