0

I have created a custom DAC, Graph, and Screen to manage tracking of new entity for client, called "Management Company." New screen is simple Grid with CRUD controls. Selector on Customer screen allows me to choose from list of "Management Company" entries. I also added new field to Contact DAC and DB table to track which "Management Company" is assigned to a given contact. This field is where the selector is configured.

I am trying to enable the "AllowAddNew" and/or "AllowEdit" properties of this selector. When I set to "True," the buttons show up but they don't do anything.

I can create and save new entries to this DB table via the new screen and I can retrieve them with the Selector just fine. I just can't create new from selector.

I have tried looking this up and I'm not finding much information.

How can I achieve this?

Sample of DAC:

namespace PX.Objects.CR
{
    [Serializable]
    public class UsrCustomerManagementCompany : IBqlTable
    {
        #region MancompID
        [PXDBString(16, IsUnicode = true, InputMask = ">LLLLLLLLLLLLLLLL", IsKey = true)]
        [PXUIField(DisplayName = "Company ID")]
        [PXDefault]
        public virtual string MancompID { get; set; }
        public abstract class mancompID : IBqlField { }
        #endregion

        #region MancompName
        [PXDBString(60, IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "Company Name")]
        [PXDefault]
        public virtual string MancompName { get; set; }
        public abstract class mancompName : IBqlField { }
        #endregion

        #region MancompDescr
        [PXDBString(4000, IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "Description")]
        public virtual string MancompDescr { get; set; }
        public abstract class mancompDescr : IBqlField { }
        #endregion
    }
}

Graph:

using System;
using PX.Data;
using PX.Objects.CR;

namespace ClientCode
{
    public class ManagementCompanyMaint : PXGraph<ManagementCompanyMaint, UsrCustomerManagementCompany>
    {
        public PXSelect<UsrCustomerManagementCompany> ManagementCompanies;
    }
}

Contact DAC Extension and Selector:

namespace PX.Objects.CR
{
    public class ContactExt : PXCacheExtension<PX.Objects.CR.Contact>
    {
        #region UsrManagementCompany
        [PXDBString]
        [PXUIField(DisplayName = "Management Company")]
        [PXSelector(
            typeof(Search<UsrCustomerManagementCompany.mancompID>),
            new Type[]
            {
                  typeof(UsrCustomerManagementCompany.mancompID),
                  typeof(UsrCustomerManagementCompany.mancompName)
            },
            SubstituteKey = typeof(UsrCustomerManagementCompany.mancompName)
        )]

        public virtual string UsrManagementCompany { get; set; }
        public abstract class usrManagementCompany : IBqlField { }
        #endregion
    }
}
Lauren Moylan
  • 135
  • 1
  • 9

1 Answers1

2

I think all you are missing is the PXPrimaryGraph attribute on your DAC to indicate for that record type what is the main graph to refer to.

In your case try adding...

[PXPrimaryGraph(typeof(ClientCode.ManagementCompanyMaint))]
[Serializable]
public class UsrCustomerManagementCompany : IBqlTable
{
    //...
}

Here are some related questions that might also help:

How to create a hyperlink user field

how to use AllowEdit in Acumatica

Brendan
  • 5,428
  • 2
  • 17
  • 33
  • As it turns out that was exactly what I was missing. I added the PXPrimaryGraph attribute and recompiled, and now I can click either button and get a popup of my custom screen. Thank you for prompt reply! – Lauren Moylan Apr 29 '19 at 14:10
  • For anyone struggling to get the link to show up in more recent versions of Acumatica, try this: https://stackoverflow.com/a/65415461/3718361 – Deetz Dec 22 '20 at 20:33