You can start by making a new graph derived from the graph used by the screen you need to copy (Customer Contracts).
Then you should copy the aspx file of the screen but change the graph being used from the old graph to your graph. Look for px:PXDataSource
in the copy of aspx file and change the TypeName
attribute to the full name (with namespace part) of your graph.
All business logic, like graph events, graph extensions, views, actions that applies to the base graph will apply to the derived graph as well. Additionally you may introduce your own business logic to the derived graph which will apply only to it. There are some Acumatica screens that use this approach (AR301000 and SO301000).
Note that it may be hard to write and support something complex with it if you do not control the code of the base graph. The derived graph will also be a subject to every change done to the base graph. Therefore in general it is recommended to introduce your own independent graph. But in your case when you need a complete copy of the screen's logic you can try this approach,
DACs are not specific to a particular graph, they can be used by another graph. If you need to change an existing field in DAC you can use DAC extensions to do it independently of all graphs. You can also use them to add a new field to DAC:
https://help-2021r1.acumatica.com/Help?ScreenId=ShowWiki&pageid=114ae5af-8667-4933-b53d-c4c8667c85ac
Or you can use graph's cache attached events to change attribute's on the existing DAC field for particular graph (for example, change the label displayed for the field by changing PXUIFieldAttribute.DisplayName
):
https://help-2021r1.acumatica.com/Help?ScreenId=ShowWiki&pageid=80e817bd-e70b-45b9-a9b1-2d2d0e2f8ee2
If you have a need to change a lot of things in the DAC declaration you can use the following trick supported by the Acumatica platform. Make a copy of the DACs declaration and change the namespace to your custom namespaces. Then this will count as a separate class/DAC from the C#/Acumatica Framework point of view. However it will be still mapped to the same database table. You can change attributes on the DAC property fields or remove some properties that you don't use. This won't affect the original DAC and the business logic in graphs that use it.
UPDATE:
I forgot about an important moment. Thanks to @brian-stevens for pointing this out.
If you need to change the default navigation in the system to go to your screen instead of an existing one (for example, the navigation from GI) then you will need to do some extra work.
The navigation is defined via PXPrimaryGraphAttribute
which is declared on a DAC like this:
[PXPrimaryGraph(typeof(MyGraph))]
public class MyDac : IBqlTable
{
...
}
You need to pass the type of the graph used by the screen to which you want to navigate by default. The declaration of PXPrimaryGraphAttribute
may include several graph types and conditions to allow navigation to different screens depending on different conditions. For instance, you can navigate to different screens depending on the type of the document. You can look at PX.Objects.AP.APRegister
for an example.
However, PXPrimaryGraphAttribute
is declared not on a DAC field property but on the DAC itself. Therefore it is impossible to customize it with the approach used to change attributes of DAC properties. If you don't own the source code of the DAC then it is impossible to change its PXPrimaryGraphAttribute
declaration.
In this case I would try the following approach. You can declare PXPrimaryGraphAttribute
on your graph and pass the type of the primary DAC to its constructor. According to the documentation this should override the navigation for this DAC.
[PXPrimaryGraph(typeof(PrimaryDac))]
public class MyCopyOfGraph : BaseGraph
{}
Here are links to the documentation and related SO question:
UPDATE 2
After checking the code I discovered that Acumatica platform actually provides you an ability to override DAC's default navigation by declaring PXPrimaryGraphAttribute
attribute on a DAC extension like this:
[PXPrimaryGraph(typeof(MyCopyOfGraph))]
public class MyDacExtension : PXCacheExtension<MyDac>
{
...
}
UPDATE 3
Another concern that was recently mentioned by my colleague is the workflow of the screen. You will need to override the existing workflow and define your own.