Skip to main content

I am attempting to override the DAC attribute of TXAvalaraCustomerUsageType with a custom derivative. It is working on DAC extensions, however, there are some existing graphs that are already overriding with CacheAttached and if I try to do my own graph extension, it is not applying my change.  For example:

CustomerMaint has this:

"PXDBString(1, IsFixed = true, BqlField = typeof(PX.Objects.CR.Standalone.Location.cAvalaraCustomerUsageType))]
/PXUIField(DisplayName = "Entity Usage Type", Required = true)]
/TXAvalaraCustomerUsageType.List]
/PXDefault("0", typeof(Search<CustomerClass.avalaraCustomerUsageType, Where<CustomerClass.customerClassID, Equal<Current<Customer.customerClassID>>>>))]
protected virtual void _(Events.CacheAttached<PX.Objects.CR.Standalone.Location.cAvalaraCustomerUsageType> e)
{
}

And I am trying to change the TXAvalaraCustomerUsageType.List (note: this is what’s in the code but the class is actually TXAvalaraCustomerUsageType.ListAttribute)

-PXRemoveBaseAttribute(typeof(TX.TXAvalaraCustomerUsageType.ListAttribute))]
bPXMergeAttributes(Method = MergeMethod.Append)]
bAvalaraCustomerUsageTypeAttribute1]
protected virtual void _(Events.CacheAttached<PX.Objects.CR.Standalone.Location.cAvalaraCustomerUsageType> e)
{
}

This is not working, but my attribute is good and it works in DAC extensions using 

ePXRemoveBaseAttribute(typeof(TX.TXAvalaraCustomerUsageType.ListAttribute))]
public string AvalaraCustomerUsageType { get; set; }

But not working in cacheattached to override CustomerMaint.

Notice I have to use TXAvalaraCustomerUsageType.ListAttribute because TXAvalaraCustomerUsageType.List does not resolve to anything in the codebase, and yet, CustomerMaint class shows it as thus.

Hi @rjean09 

Did you try replacing the whole set of attributes?

>PXMergeAttributes(Method = MergeMethod.Replace)]
>PXDBString(1, IsFixed = true, BqlField = typeof(CR.Standalone.Location.cAvalaraCustomerUsageType))]
>PXUIField(DisplayName = "Entity Usage Type", Required = true)]
>AvalaraCustomerUsageTypeAttribute1]
>PXDefault(TXAvalaraCustomerUsageType.Default,
typeof(Search<AR.CustomerClass.avalaraCustomerUsageType,
Where<AR.CustomerClass.customerClassID,
Equal<Current<AR.Customer.customerClassID>>>>))]
protected virtual void _(Events.CacheAttached<CRLocation.cAvalaraCustomerUsageType> e) { }

Also I noticed that your extension is named attribute1 with a “ 1 “ at the end. You should avoid that and have it renamed to, for example, AvalaraCustomerUsageTypeExtAttribute. Then you can use it as 

 

Hope this helps


Got the solution from dev support.  I didn’t notice that although the cache attached is in the CustomerMaint.cs file, it is actually a different class (DefLocationExt)

 

So the solution is just to create a graph extension on the correct graph:

 


Update: the above code works, but was getting an error publishing.

See this stackoverflow: https://stackoverflow.com/questions/71531520/graph-extension-is-marked-as-pxoverride-but-the-original-method-with-such-nam

Was able to correct by just adding DefContactAddressExt to the graph extension declaration.


Was able to correct by just adding DefContactAddressExt to the graph extension declaration.

Thank you!


Reply