Woody
Woody

Reputation: 7

Is there a easy way to customize Acumatica build-in dropdown list?

For example, in screen CR301000, source field is having 5 items right now, but I want to have 6 different items listing here, please advice how to do it. Thanks.

Upvotes: 0

Views: 1347

Answers (3)

vachmir
vachmir

Reputation: 21

Here is an example of creating Acumatica dropdown list field. Add constatnt fields and Pair them in Tuple<T1, T2>[].

public class Operators
{
    public const string And = "&&";
    public const string Or = "||";


    public class UI
    {
        public const string And = "And";
        public const string Or = "Or";
    }

    public class OperatorsAttribute : PXStringListAttribute
    {
        public OperatorsAttribute() : base(new Tuple<string, string>[]
        {
            Pair(And, UI.And),
            Pair(Or, UI.Or)
        })
        {}
    }
}

Then you use the nested OperatorsAttribute attribute class on the field like this.

    #region Operator
    public abstract class operators : BqlString.Field<operators> { }
    [PXDBString(15)]
    [PXDefault(1)]
    [OperatorsAttribute]
    [PXUIField(FieldName = "Operators", DisplayName = "Operators")]
    public virtual string Operators { get; set; }
    #endregion

To change already existing fields, create Extension classes for DACs and Graphs. Here is the detailed documentation for creating extension classes — Acumatica ERP Customization Guide

Upvotes: 0

M.Mynatt
M.Mynatt

Reputation: 26

Add the Values you want: Just a quick note if you chose to add via automation - to add a new field click in the white space of the lookup field - You will see the current values - in the white space below - dbl click.

Upvotes: 0

Jeff Williams
Jeff Williams

Reputation: 1026

You can do it a few ways.

1) Customization to create a custom string/int list then override the dac attribute in the BLC to point to your custom list.

First create the custom stringlist:

public class CustomSourceAttribute : PXStringListAttribute
{
    public const string _LEADPROSPECT = "1";
    public const string _INITIALCONTACT = "2";
    public const string _QUALIFIED = "3";
    public const string _INITIALPRICE = "4";
    public const string _PROPOSALSENT = "5";
    public const string _POSITIVEPROPOSAL = "6";
    public const string _VERBALCOMMIT = "7";
    public const string _READYFORCONTRACT = "R";
    public const string _CONTRACTSENT = "8";
    public const string _CONTRACTSIGNED = "9";
    public const string _CLOSEDLOST = "0";
    public const string _TARGET = "T";
    public CustomSourceAttribute()
        : base(new string[]
    {
        _LEADPROSPECT,
        _INITIALCONTACT,
        _QUALIFIED,
        _INITIALPRICE,
        _PROPOSALSENT,
        _POSITIVEPROPOSAL,
        _VERBALCOMMIT,
        _READYFORCONTRACT,
        _CONTRACTSENT,
        _CONTRACTSIGNED,
        _CLOSEDLOST,
        _TARGET
    },
            new string[]
    {
        "Lead/Prospecting",
        "Initial Contact",
        "Qualified",
        "Initial Pricing Sent",
        "Proposal Sent",
        "Positive Proposal Discussions",
        "Verbal Commitment",
        "Ready for Contract",
        "Contract Sent",
        "Contract Signed",
        "Closed Lost",
        "Target"
    })
    {
    }
}

Then override the dac attribute in a BLC Extension:

        [PXDBString(1, IsFixed = true)]
    [PXUIField(DisplayName = "Stage")]
    [CustomSourceAttribute]
    [PXDefault(CustomSourceAttribute._INITIALCONTACT)]
    [PXMassUpdatableField]
    protected void CROpportunity_StageID_CacheAttached(PXCache cache)
    { 
    }

This sample is from the Opportunity screen but the same holds true w/ leads

2) Automation step to provide the new values.

See here for automation step locations

the second way doesn't require customization but does take more work if there is already automation steps defined. You need to create the custom list for each step that exists.

For something like Leads, I'd go with option 1 as there is tons of steps

Upvotes: 6

Related Questions