Question

Cross reference - Alternate type

  • 25 November 2020
  • 4 replies
  • 69 views

Can we rename the Alternate Type
e.g “Global” I want to rename to “ABC”

 


4 replies

Userlevel 4
Badge +1

Hi @pandachan48,

 

We can have below code in InventoryItemMaint Extension graph to rename the UI field name by using cache_attached event.

        [PXMergeAttributes(Method = MergeMethod.Append)]
        [PXCustomizeBaseAttribute(typeof(PXUIFieldAttribute), nameof(PXUIFieldAttribute.DisplayName), "ABCD")]
        protected virtual void INItemXRef_AlternateType_CacheAttached(PXCache sender) { }
 

Please find the screenshot for the reference.

 

thank you for your reply 
but I mean I need to rename “Global” to ABCD

 

 

I found it how to rename the name (Translation Dictionaries), but after I changed, I cannot change back or change to another
could some one advice how to change back or rename to another? 

thank you!!

 

Userlevel 4
Badge +1

Hi @pandachan48 ,

 

Understood. To modify the dropdown item values, please use the code like below.

 

public class InventoryItemMaintAMIExt : PXGraphExtension<InventoryItemMaint>
    {
[PXMergeAttributes(Method = MergeMethod.Append)] 
        [PXRemoveBaseAttribute(typeof(INAlternateType))]
        [INAlternateTypeExt.List()]
        protected virtual void INItemXRef_AlternateType_CacheAttached(PXCache sender) { }

}

 

 public class INAlternateTypeExt
    {
        public class List : PXStringListAttribute
        {
            public List() : base(
                new[]
            {
                    Pair(CPN, PX.Objects.IN.Messages.CPN),
                    Pair(VPN, PX.Objects.IN.Messages.VPN),
                    Pair(Global, "ABCD"),
                    Pair(Barcode, PX.Objects.IN.Messages.Barcode),
                })
            { }
        }

        public const string CPN = "0CPN";
        public const string VPN = "0VPN";
        public const string MFPN = "MFPN";
        public const string Global = "GLBL";
        public const string Substitute = "SBST";
        public const string Obsolete = "OBSL";
        public const string SKU = "SKU";
        public const string UPC = "UPC";
        public const string EAN = "EAN";
        public const string ISBN = "ISBN";
        public const string GTIN = "GTIN";
        public const string Barcode = "BAR";

        public class cPN : PX.Data.BQL.BqlString.Constant<cPN>
        {
            public cPN() : base(CPN) {; }
        }

        public class vPN : PX.Data.BQL.BqlString.Constant<vPN>
        {
            public vPN() : base(VPN) {; }
        }

        public class global : PX.Data.BQL.BqlString.Constant<global>
        {
            public global() : base(Global) {; }
        }

        public class obsolete : PX.Data.BQL.BqlString.Constant<obsolete>
        {
            public obsolete() : base(Obsolete) {; }
        }
        public class barcode : PX.Data.BQL.BqlString.Constant<barcode>
        {
            public barcode() : base(Barcode) {; }
        }
        public static string ConvertFromPrimary(INPrimaryAlternateType aPrimaryType)
        {
            return aPrimaryType == INPrimaryAlternateType.VPN ? INAlternateType.VPN : INAlternateType.CPN;
        }

        public static INPrimaryAlternateType? ConvertToPrimary(string aAlternateType)
        {
            INPrimaryAlternateType? result = null;
            switch (aAlternateType)
            {
                case INAlternateType.VPN:
                    result = INPrimaryAlternateType.VPN; break;
                case INAlternateType.CPN:
                    result = INPrimaryAlternateType.CPN; break;
            }
            return result;
        }

    }

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2020  Acumatica, Inc. All rights reserved