3

I have created a custom screen which is a duplicate of the Customer screen. The question is, when we enter customer id in universal search, how we can redirect to our custom screen instead of the Customer screen. Please have a look at the graph code of our custom screen.

public class CustomScreen : BusinessAccountGraphBase<Customer, Customer, Where<BAccount.type, Equal<BAccountType.customerType>,
                Or<BAccount.type, Equal<BAccountType.combinedType>>>>
    {
    } 
John
  • 763
  • 3
  • 11
  • Why are you duplicating the customer screen and not customizing it? – JvD Apr 29 '20 at 13:02
  • That is user requirement and this duplicate customer screen is just view purpose to view all transaction data will see in this duplicate customer screen – BhavyaSri Apr 30 '20 at 15:35

1 Answers1

1

The Search box is using the value of the Note ID field of the records as the key for finding the record in the SearchIndex where the EntityType is stored for the record. From the EntityType it is reading the value of the PXPrimaryGraphAttribute and doing the redirect to the specified graph.

To change the page where the redirect will go you need to change the value of the PXPrimaryGraphAttribute of that DAC.

You can try adding the PXPrimaryGraphAttribute to your graph to indicate that it is the primary graph for the specified DAC. Per documentation, it is supposed to override the primary graph set by the PXPrimaryGraphAttribute applied to the Customer DAC.

In case of Customer DAC the applied attribute is the following:

[CRCacheIndependentPrimaryGraphList(new Type[]
{
    typeof(BusinessAccountMaint),
    typeof(CustomerMaint),
    typeof(CustomerMaint),
    typeof(CustomerMaint),
    typeof(BusinessAccountMaint)
}, new Type[]
{
    typeof(Select<BAccount, Where<BAccount.bAccountID, Equal<Current<BAccount.bAccountID>>, And<Current<BAccount.viewInCrm>, Equal<True>>>>),
    typeof(Select<Customer, Where<Customer.bAccountID, Equal<Current<BAccount.bAccountID>>, Or<Customer.bAccountID, Equal<Current<BAccountR.bAccountID>>>>>),
    typeof(Select<Customer, Where<Customer.acctCD, Equal<Current<BAccount.acctCD>>, Or<Customer.acctCD, Equal<Current<BAccountR.acctCD>>>>>),
    typeof(Where<BAccountR.bAccountID, Less<Zero>, And<BAccountR.type, Equal<BAccountType.customerType>>>),
    typeof(Select<BAccount, Where<BAccount.bAccountID, Equal<Current<BAccount.bAccountID>>, Or<Current<BAccount.bAccountID>, Less<Zero>>>>)
})]

As you can see depending on the specified conditions the DAC can be assigned to either BusinessAccountMaint or CustomerMaint and you need to change the conditions and graphs correspondingly to what you need.

For example like below:

[CRCacheIndependentPrimaryGraphList(new Type[]
{
    typeof(BusinessAccountMaint),
    typeof(CustomScreen),
    typeof(CustomScreen),
    typeof(CustomScreen),
    typeof(BusinessAccountMaint)
}, new Type[]
{
    typeof(Select<BAccount, Where<BAccount.bAccountID, Equal<Current<BAccount.bAccountID>>, And<Current<BAccount.viewInCrm>, Equal<True>>>>),
    typeof(Select<Customer, Where<Customer.bAccountID, Equal<Current<BAccount.bAccountID>>, Or<Customer.bAccountID, Equal<Current<BAccountR.bAccountID>>>>>),
    typeof(Select<Customer, Where<Customer.acctCD, Equal<Current<BAccount.acctCD>>, Or<Customer.acctCD, Equal<Current<BAccountR.acctCD>>>>>),
    typeof(Where<BAccountR.bAccountID, Less<Zero>, And<BAccountR.type, Equal<BAccountType.customerType>>>),
    typeof(Select<BAccount, Where<BAccount.bAccountID, Equal<Current<BAccount.bAccountID>>, Or<Current<BAccount.bAccountID>, Less<Zero>>>>)
})]
public class CustomScreen : BusinessAccountGraphBase<Customer, Customer, Where<BAccount.type, Equal<BAccountType.customerType>,
            Or<BAccount.type, Equal<BAccountType.combinedType>>>>
{
} 
Samvel Petrosov
  • 7,580
  • 2
  • 22
  • 46
  • Hi Samvel, I tried the given solution by adding above my custom graph and rebuilt index in SM209500 even after that when i search customer it is redirecting to customer screen only not to my custom screen, also i didn't create customer extension DAC. Updated code above please refer and let me know the issue please. – BhavyaSri Apr 30 '20 at 15:26
  • Here is the modified code after the answer ` [CRCacheIndependentPrimaryGraphList(new Type[] { typeof(BusinessAccountMaint), typeof(CustomerDupMaint), typeof(CustomerDupMaint), typeof(CustomerDupMaint), typeof(BusinessAccountMaint) }, new Type[]{ typeof(Select>, And, Equal>>>), typeof(Select>, Or>>>>), ` – BhavyaSri Apr 30 '20 at 15:40
  • typeof(Select>, Or>>>>), typeof(Where, And>>), typeof(Select>, Or, Less>>>)})] public class CustomerDupMaint : BusinessAccountGraphBase, Or>>> { } – BhavyaSri Apr 30 '20 at 15:42