Create a new attribute from default attribute.


Userlevel 2
Badge
namespace PX.Objects.CR
{
//
// Summary:
// Attribute to specify system values for PX.Objects.CR.Contact.source, PX.Objects.CR.CRLead.source
// and PX.Objects.CR.CROpportunity.source. Values for those screen should be adjusted
// by adjusting System Workflow for those screens.
public class CRMSourcesAttribute : PXStringListAttribute
{
[Obsolete("This source is used only for backward compatibility.")]
public const string _WEB = "W";
[Obsolete("This source is used only for backward compatibility.")]
public const string _PHONE_INQ = "H";
[Obsolete("This source is used only for backward compatibility.")]
public const string _REFERRAL = "R";
[Obsolete("This source is used only for backward compatibility.")]
public const string _PURCHASED_LIST = "L";
[Obsolete("This source is used only for backward compatibility.")]
public const string _OTHER = "O";
public const string OrganicSearch = "S";
public const string Campaign = "C";
public const string Referral = "R";
public const string Other = "O";
public const string Web = "W";
public const string PhoneInquiry = "H";
public const string PurchasedList = "L";

public CRMSourcesAttribute();
}
}

I want to add some new options in this default attribute. How can I create a new attribute using this attribute ? I have tried extending this attribute in my new attribute but that doesn't work. Can anyone help me here ?


8 replies

Userlevel 7
Badge +17

Hi @param2022  Below links might help you!! Please do refer.

https://stackoverflow.com/questions/49906357/acumatica-dynamic-dropdown

https://blog.zaletskyy.com/post/2020/04/17/post100

Userlevel 2
Badge

@Naveen Boga i tried the code in the link you have shared and it is not working as I want it to. But i think if focuses on creating a new attribute and not extending the existing attribute into newly created attribute.

I am able to create a new Attribute successfully but I don’t want to write the options that are already present in the StringList, I just want to inherit existing ones and add the new ones.

Userlevel 7
Badge +17

Hi @param2022  If that is the case, you can refer to the below link.

This article will explain about adding new items to the existing dropdown by inheriting the existing attribute list

https://riptutorial.com/acumatica/example/29102/modifying-marital-statuses

 

hope this helps!

Userlevel 2
Badge

@Naveen Boga this link has solved a lot of issue. But In one of the dropdown there is this formula that is preventing new fields to be added over there any way to solve this or override this? I created a new field in DACExtension bu still it is not showing updated options over here. At oyher places new options are added sucessfully.

[CRMSources]
[PXDBString(1, IsFixed = true, BqlField = typeof(Standalone.CROpportunity.source))]
[PXFormula(typeof(BqlOperand<Current<source>, IBqlString>.When<BqlOperand<Current<source>, IBqlString>.IsNotNull>.Else<Use<Selector<contactID, Contact.source>>.AsString>))]
[PXMassUpdatableField]
[PXUIField(DisplayName = "Source", Visibility = PXUIVisibility.Visible, Visible = true)]
public virtual string Source { get; set; }

this is the base field I am trying to override.

Userlevel 7
Badge +17

Hi @param2022  Did you check by removing the [PXFormula] and [PXMassUpdatableField] attributes?

Userlevel 2
Badge

@Naveen Boga Yes I have only mentioned this much in my DAC Extension.

[NewSources]
[PXMergeAttributes(Method = MergeMethod.Append)]
      
public string Source { get; set; }
public abstract class source : BqlType<IBqlString, string>.Field<source> { };

Userlevel 7
Badge +17

Hi Param,

Also, try like below.

  • Remove the Base Attribute
  • Then add new attribute i.e. [NewSources]

screenshot for reference.

 

 

 

Userlevel 2
Badge

@Naveen Boga 

 

#region
        [NewSources]
        [PXMergeAttributes(Method = MergeMethod.Append)]
        [PXRemoveBaseAttribute(typeof(CRMSourcesAttribute))]
        public string Source { get; set; }
        public abstract class source : BqlType<IBqlString, string>.Field<source> { };
        #endregion

 

this is my current code and after publishing this, it is showing error. 

 

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