Can we rename the Alternate Type
e.g “Global” I want to rename to “ABC”
Best answer by Naveen Boga
View originalCan we rename the Alternate Type
e.g “Global” I want to rename to “ABC”
Best answer by Naveen Boga
View originalI 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.
Hi
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;
}
}
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!!
Hi
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.
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.