Solved

Getting default DAC and Primary View

  • 28 June 2021
  • 4 replies
  • 282 views

Userlevel 1

Hi,

I am trying to get the default DAC and its primary view from the Type. Any suggestions?

I have Type defined as below

and I have field as below values

 

icon

Best answer by Hughes Beausejour 28 June 2021, 21:54

View original

4 replies

Userlevel 1

Hi Hughes,

CreateInstance does not help in this case as I am writing the method which is actually a part of CreateInstance at some point which leads to infinite loop.

However, I did found the parentcode where I can directly call graph.PrimaryItemType and it helped.

Thank you for your help.

Userlevel 5
Badge +2


Does this work?
Type graphType = typeof(PX.Objects.SO.SOOrderEntry);
var graph = PXGraph.CreateInstance(graphType);

Userlevel 1

Thanks Hughes.

I can try that but my graph is of Type (screenshot 1). Can I convert graph of Type into its base or original type? I have even tried using PXGraph.CreateInstance but looks like that wouldn’t help either.

 

Userlevel 5
Badge +2

Hi Krunal,

Try PXGraph.PrimaryItemType, PXGraph.PrimaryView properties and PXView.GetItemType method:

Example:
var graphPrimaryCache = graph.Caches[graph.PrimaryItemType];
var grapPrimaryView = graph.Views[graph.PrimaryView];
var graphPrimaryViewCache = graph.Caches[graph.Views[graph.PrimaryView].GetItemType()];

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