I have a generic graph extension that I would like to get the extensions dynamically. For example I want dynamically get “TGraph” & “_” & “Extension”.
The TGraph is dynamic based on the base graph but the extension is fixed.
I have a generic graph extension that I would like to get the extensions dynamically. For example I want dynamically get “TGraph” & “_” & “Extension”.
The TGraph is dynamic based on the base graph but the extension is fixed.
CLARIFICATION
for example let say I am getting a graph ext like this
APInvoiceEntry_ApprovalWorkflow BaseAW = Base.GetExtension<APInvoiceEntry_ApprovalWorkflow>();
Now instead of “APInvoiceEntry_ApprovalWorkflow” I want dynamically replace the base graph part like this
var graphExtensionName = $"{typeof(TGraph).Name}_ApprovalWorkflow";
how can I do this?
I found no way to do it so I had to iterate all extension and check for the one I need, example:
private MyExtension<TGraph, TPrimary> GetTeamsGenericGraphExtension()
{
PXGraph graph = Base.TypelessClone();
PXGraphExtension graphExt = null;
MyExtension<TGraph, TPrimary> graphGenericExt = null;
int i = 0;
do
{
graphExt = graph.GetExtension(i++);
graphGenericExt = graphExt as MyExtension<TGraph, TPrimary>;
} while (graphExt != null && graphGenericExt == null);
return graphGenericExt;
}
Hi
I do really appreciate the response Hughes. What I ended up doing couple of months ago when I was working on this, was to write a case Method to check the Base Graph and return the expected Extension.
i have already implemented and tested the project I was working on it but I will utilize your suggested method next time I come across similar issue to see how it works. Considering we should have a very limited number of extension records, the loop shouldn’t pose performance degradations.
Thanks again.
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.