Skip to main content
Solved

Getting default DAC and Primary View


KrunalDoshi
Freshman II

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

 

Best answer by Hughes Beausejour

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()];

View original
Did this topic help you find an answer to your question?

4 replies

Hughes Beausejour
Acumatica Employee
Forum|alt.badge.img+2
  • Acumatica Developer Support Team
  • 91 replies
  • Answer
  • June 28, 2021

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()];


KrunalDoshi
Freshman II
  • Author
  • Freshman II
  • 10 replies
  • June 28, 2021

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.

 


Hughes Beausejour
Acumatica Employee
Forum|alt.badge.img+2
  • Acumatica Developer Support Team
  • 91 replies
  • June 28, 2021


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


KrunalDoshi
Freshman II
  • Author
  • Freshman II
  • 10 replies
  • June 29, 2021

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.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings