Home > Back-end >  Acumatica PXGraphExtension error using CRActivity
Acumatica PXGraphExtension error using CRActivity

Time:03-01

I have no idea why Acumatica is throwing this validation error message when I try to setup a graph extension with CRActivity. Here is the error message and the code snippet. Does anyone know why I am seeing this error and what I can do about it?

\App_RuntimeCode\CRActivityMaint.cs(21): error CS0311: The type 'PX.Objects.CR.CRActivity' cannot be used as type parameter 'Graph' in the generic type or method 'PXGraphExtension'. There is no implicit reference conversion from 'PX.Objects.CR.CRActivity' to 'PX.Data.PXGraph'

public class CRTaskMaint : PXGraphExtension<CRActivity>
{
    protected virtual void _(Events.FieldSelecting<CRActivity, CRActivityExt.usrContactName> e)
    {
      if(e.Row!=null && e.Row.RefNoteID!=null)
      {
                    Guid? refNoteID = e.Row.RefNoteID;
                    var helper= new EntityHelper(this.Base);
                    var relatedRecord = helper.GetEntityRow(refNoteID) as Contact;
                    if(relatedRecord!=null)
                      e.ReturnValue = relatedRecord.DisplayName;
      } // end of if
    } // end of usrContactName
} // end of class

CodePudding user response:

A graph extension needs the name of the graph you are extending, not the primary DAC. Do this instead. Typically, we add Ext to the end of the graph we are extending when naming it, so I did so here as well.

public class CRTaskMaintExt : PXGraphExtension<CRTaskMaint>

CodePudding user response:

I think the issue is with the declaration of CRTaskMaint. You should pass that graph for extending the same. Kindly change as below and that should fix the error. Below is when you want to extend CRTaskMaint graph.

public class CRTaskMaintExt : PXGraphExtension<CRTaskMaint, CRActivity>
{
    .....
} 

And another tip is you can use the Customization Project Editor to check the syntax while extending a graph or a DAC.

  • Related