Anyone have a way to solve this sql error when trying to automate schedule a custom filtered processing screen in acumatica?
Value Cannot be null, parameter name key.
Below is the stack trace. My ID field does have IsKey = true in the DAC and is a Primary Key in the sql script
12/20/2022 11:09:19 AM Error:
Value cannot be null.
Parameter name: key
at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at PX.Data.PXViewCollection.TryGetOrCreateValue(String key, PXView& value)
at PX.Data.PXViewCollection.get_Item(String key)
at PX.SM.AUScheduleMaint.OnScreenIdChanged(PXCache sender, AUSchedule schedule)
at PX.Data.PXCache.OnRowInserted(Object item, Object pending, Boolean externalCall)
at PX.Data.PXCache`1.Insert(Object data, Boolean bypassinterceptor)
at PX.Data.PXCache`1.Insert(Object data)
at PX.Data.PXSelectBase`1.Insert(Table item)
at PX.Data.PXFilteredProcessing`2._ScheduleAdd_(PXAdapter adapter)
at PX.Data.PXAction`1.RunHandler(PXAdapter adapter)
at PX.Data.PXAction`1.d__28.MoveNext()
at PX.Data.PXAction`1.d__28.MoveNext()
at PX.Data.PXAction`1.d__28.MoveNext()
at PX.Data.PXAction`1.d__28.MoveNext()
at PX.Web.UI.PXBaseDataSource.tryExecutePendingCommand(String viewName, String[] sortcolumns, Boolean[] descendings, Object[] searches, Object[] parameters, PXFilterRow[] filters, DataSourceSelectArguments arguments, Boolean& closeWindowRequired, Int32& adapterStartRow, Int32& adapterTotalRows) in C:\Users\svc-builder\AppData\Local\Temp\~PX.Web..1\PX.Web.UI.dll.il:line 110930
at PX.Web.UI.PXBaseDataSource.ExecuteSelect(String viewName, DataSourceSelectArguments arguments, PXDSSelectArguments pxarguments) in C:\Users\svc-builder\AppData\Local\Temp\~PX.Web..1\PX.Web.UI.dll.il:line 108573
My ID field does have IsKey = true in the DAC and is a Primary Key in the sql script enter image description here
Filter DAC:
public class NGZoomProcessingFilter : IBqlTable
{
#region OperationID
[PXInt(IsKey = true)]
[PXUIField(DisplayName = "Operation ID")]
[OperationIDEntityType]
public virtual int? OperationID { get; set; }
public abstract class operationID :
PX.Data.BQL.BqlInt.Field<operationID>
{
}
#endregion
#region OverrideLastRunDate
[PXDate()]
[PXUIField(DisplayName = "Override Last Run")]
public virtual DateTime? OverrideLastRunDate { get; set; }
public abstract class overrideLastRunDate :
PX.Data.BQL.BqlDateTime.Field<overrideLastRunDate>
{
}
#endregion
Main DAC:
{
[Serializable]
[PXCacheName("Zoom Processing Routine")]
public class NGZoomProcessingRoutine : IBqlTable
{
public class PK :
PrimaryKeyOf<NGZoomProcessingRoutine>.By<operationID>
{
public static NGZoomProcessingRoutine Find(
PXGraph graph, int? operationID)
=> FindBy(graph, operationID);
}
#region Selected
[PXBool]
[PXUnboundDefault(false)]
[PXUIField(DisplayName = "Selected")]
public virtual bool? Selected { get; set; }
public abstract class selected : BqlBool.Field<selected>
{
}
#endregion
#region OperationID
[PXDBInt(IsKey = true)]
[PXUIField(DisplayName = "Operation ID")]
[OperationIDEntityType]
public virtual int? OperationID { get; set; }
public abstract class operationID :
PX.Data.BQL.BqlInt.Field<operationID>
{
}
#endregion
#region LastRun
[PXDBDate()]
[PXUIField(DisplayName = "Last Run")]
public virtual DateTime? LastRun { get; set; }
public abstract class lastRun :
PX.Data.BQL.BqlDateTime.Field<lastRun>
{
}
#endregion
Graph:
{
//PrepareDataScreen
public class NGZoomProcessing : PXGraph<NGZoomProcessing>
{
public PXCancel<NGZoomProcessingFilter> Cancel;
public PXFilter<NGZoomProcessingFilter>
Filter;
public PXFilteredProcessing<NGZoomProcessingRoutine,
NGZoomProcessingFilter> ProcessingRoutine;
public PXSetup<NGZoomProcessingSettings> Settings;
public SelectFrom<NGPgtAIntroWebinarParticipant>.View
Participants;
public SelectFrom<NGPgtAIntroWebinarInstance>.View Webinars;
protected void _(Events.RowSelected<NGZoomProcessingFilter>
e)
{
if (e.Row is null) return;
DateTime? lastRunDate = null;
if (e.Row.OverrideLastRunDate is not null)
{
lastRunDate = e.Row.OverrideLastRunDate;
}
ProcessingRoutine.SetProcessDelegate((list) =>
SyncWebinars(list, lastRunDate));
}
I took a look at this, and its because you have IsKey=true on your filter DAC, remove it and your problem will go away