Solved

Cross reference - Alternate type

  • 25 November 2020
  • 5 replies
  • 454 views

Userlevel 1
Badge

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

 

icon

Best answer by Naveen Boga 25 November 2020, 11:56

View original

5 replies

Userlevel 7
Badge +12

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.

 

Userlevel 1
Badge

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

 

 

Userlevel 1
Badge

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 7
Badge +12

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;
        }

    }

 

Userlevel 2
Badge

I noticed that GTIN is in the code already. How do I enable that value? Our client needs to store the barcode separately from the GTIN.

 

Thank you.

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 — 2022  Acumatica, Inc. All rights reserved