0

I have a customization that I'm upgrading for Acumatica 2020R2 that did various work with Customers through a CustomerMaint graph instance.

As of 2020R2 it appears various Views have been changed in how they are implemented. Doing an Inspect Element on the controls in the screen still indicate the same View Names but reviewing CodeRepository\CustomerMaint.cs it is not clear how these Views are implemented anymore.

'CustomerMaint' does not contain a definition for 'Contacts' ...
'CustomerMaint' does not contain a definition for 'DefContact' ...
'CustomerMaint' does not contain a definition for 'Addresses' ...
'CustomerMaint' does not contain a definition for 'DefAddress' ...
'CustomerMaint' does not contain a definition for 'DefLocation' ...
'CustomerMaint' does not contain a definition for 'DefLocationContact' ...

How can I access these Views and DAC objects in 2020R2?

Nickolas Hook
  • 774
  • 5
  • 13

2 Answers2

5

In versions of Acumatica prior to 2020 R2, CustomerMaint inherits from BusinessAccountGraphBase. Starting in 2020 R2, it directly derives from PXGraph and many of the shared views needed to support the customer maintenance were moved to extensions that are mapped to properties of the graph such as DefContactAddressExt, DefLocationExt, ContactDetailsExt, LocationDetailsExt.

The views that you need are exposed by these extensions. An example of how you could retrieve the current address is from a graph extension is below:

var ext = Base.GetExtension<CustomerMaint.DefContactAddressExt>();
var address = ext.DefAddress.Current
Gabriel
  • 3,733
  • 16
  • 29
2

The accepted answer did not work for me, however by using the foreign key API (available in 18R1+), this becomes quite easy:

Contact defContact = Customer.FK.ContactInfo.FindParent(Base, Base.CurrentCustomer.Current);

Address defAddress = Customer.FK.Address.FindParent(Base, Base.CurrentCustomer.Current);

Location defLocation = Customer.FK.DefaultLocation.FindParent(Base, Base.CurrentCustomer.Current);

Contact defLocContact = Location.FK.ContactInfo.FindParent(Base, defLocation);
Deetz
  • 329
  • 1
  • 16
  • I just fixed the answer, there were two errors. Thanks for pointing it out, sorry it took so long for me to see this! – Gabriel Dec 23 '21 at 15:01