Search code examples
c#.netacumaticaacumatica-kb

Is it possible to set a default to an Action DropDown?


I'm trying to set the default of this action dropdown by placing the [PXDefault] attribute to the Cache attached on the Graph Extension but it doesn't work. I've searched the Original field attributes to get a better understanding of the field and I found out it is a [PX.Data.Automation.PXWorkflowMassProcessing(DisplayName = "Action")] and that's the reason the [PXDefault] attribute is not working.

I'm trying to set the default to the Print/Email Orders Page (SO301000) enter image description here

can someone help me with this.


Solution

  • In case you need to default to the first item, in the PXWorkflowMassProcessingAttribute, you can set the AddUndefinedState = false which would remove the SELECT and default to the first value

    The PXDefault should still work, it's just that you need to set it to the value and not to the display label. For example, I tested the below and it worked. I don't like hard-coding that text in the PXDefault, but I am not sure whether there are any better options.

     public class SOOrderProcessExt : PXGraphExtension<SOOrderProcess>
        {
            [PXMergeAttributes(Method = MergeMethod.Append)]
            [PXDefault("SO301000$printSalesOrder")]
            public virtual string Action { get; set; }
            public abstract class action : BqlType<IBqlString, string>.Field<action> { }       
        }