Skip to main content
Answer

Extend same graph in multiple customisations

  • May 7, 2024
  • 2 replies
  • 229 views

benb1977
Freshman II
Forum|alt.badge.img

Hi,

Nice to meet you all. Long time reader first time poster.

In 2022R1, I am trying to publish a customisation that includes an extension to the SOOrderEntry graph. I am having problems though because an existing customisation that also includes an extension to the same graph is already published. The first time I tried this, the whole application crashed because my extension was the only one published, and the other customisation had other code that tried to obtain a reference to its extension using CreateInstance<SOOrderEntry>.GetExtension<”extension name”>().

I tried to replicate this error in a local instance also running 2022R1, but it didn’t happen, and browsing my filesystem provides a clue as to why. In the <Appfolder>\App_Code\Caches folder, my extension is contained in a file named ‘SOOrderEntry.cs’. The other extension is contained in a file named ‘<Package name>.SOOrderEntry.cs’, where <Package name> is the name of the .NET package it exists in. This seems to allow both extensions to coexist, and through testing, I have determined that the code for both extensions is being run.

This implies that there is some system setting that governs whether extensions can coexist like this. Does anybody know of such a setting?

 

Thanks in advance,

Ben.

Best answer by Zoltan Febert

Hi @benb1977,

There is not settings for it, the only rule is the two extensions need to have different names or namespaces.

using PX.Data;
using PX.Objects.SO;

// First customization
namespace PX.Objects.SO
{
public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{

}
}

// Second customization, same Namespace, different Name
namespace PX.Objects.SO
{
public class SOOrderEntryAnotherExt : PXGraphExtension<SOOrderEntry>
{

}
}

// Third customization, same Name, different Namespace
namespace PX.Objects.AnotherNamespace
{
public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{

}
}

 

2 replies

Zoltan Febert
Jr Varsity I
Forum|alt.badge.img+3
  • Jr Varsity I
  • Answer
  • May 8, 2024

Hi @benb1977,

There is not settings for it, the only rule is the two extensions need to have different names or namespaces.

using PX.Data;
using PX.Objects.SO;

// First customization
namespace PX.Objects.SO
{
public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{

}
}

// Second customization, same Namespace, different Name
namespace PX.Objects.SO
{
public class SOOrderEntryAnotherExt : PXGraphExtension<SOOrderEntry>
{

}
}

// Third customization, same Name, different Namespace
namespace PX.Objects.AnotherNamespace
{
public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{

}
}

 


benb1977
Freshman II
Forum|alt.badge.img
  • Author
  • Freshman II
  • May 8, 2024

Thanks @Zoltan Febert.

Yeah that’s what I did. I had the classes as defined below but it crashed the server. The other thing that may be a problem is the fact that I’m actually programming on a rebranded Acumatica product called ‘MYOB Advanced’ here in Australia. I didn’t think there would be any difference in the way customisations are coded, but that seems to be the only explanation.

// First customisation package
namespace PX.Objects.SO
{
public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{

}
}

// Second customisation package
namespace PX.Objecs.SO
{
public class SOOrderEntry_PopupExtension : PXGraphExtension<SOOrderEntry>
{

}
}