acumaticaacumatica-kb

How can I open a Generic Inquiry screen with a record via BLC code?


I've got code in a BLC to open a Generic Inquiry screen with an associated GI name - but it seems to be missing something to fill in all the fields. For example, this is what I get if I open the screen and navigate to a record manually:

enter image description here

And here is what I get when opening through code:

enter image description here

Here is the code I'm using to open the screen (where giName is a variable that contains the GI Name - "AM-Cost"):

GenericInquiryDesigner graph = PXGraph.CreateInstance<GenericInquiryDesigner>();

GIDesign gid = PXSelect<GIDesign,                               
               Where<GIDesign.name, Equal<Required<GIDesign.name>>>>.Select(this, giName);
            
if (gid == null) return;

graph.Designs.Current = gid;

throw new PXRedirectRequiredException(graph, "View Entity")
{
      Mode = PXBaseRedirectException.WindowMode.NewWindow
};

I can't see anything else that I need to provide besides the GI Name.

Is there something I'm missing?


Solution

  • When you select GIDesign, use GenericInquiryDesigner graph:

     GIDesign gid = PXSelect<GIDesign,
        Where<GIDesign.name, Equal<Required<GIDesign.name>>>>
        .Select(graph /* "this" was replaced here */, giName);