Hello guys,
I am having an issue with a workflow event handler:
Workflow declaration:
.WithHandlers(handlers =>
{
handlers.Add(handler => handler
.WithTargetOf<ARBalances>()
.OfEntityEvent<ARBalancesCreditHoldExt.MyEvents>(e => e.CreditLimitViolated)
.Is<SOShipmentEntryCreditHoldExt>(g=> g.OnCreditLimitViolated)
.UsesPrimaryEntityGetter<
SelectFrom<SOShipment>.
Where<SOShipment.customerID.IsEqual<ARBalances.customerID.FromCurrent>>>()
);
handlers.Add(handler => handler
.WithTargetOf<ARBalances>()
.OfEntityEvent<ARBalancesCreditHoldExt.MyEvents>(e => e.CreditLimitSatisfied)
.Is<SOShipmentEntryCreditHoldExt>(g => g.OnCreditLimitSatisfied)
.UsesPrimaryEntityGetter<
SelectFrom<SOShipment>.
Where<SOShipment.customerID.IsEqual<ARBalances.customerID.FromCurrent>>>()
);
})
//Add to State
lowStates.Update<SOShipmentStatus.open>(flowState =>
{
return flowState
.WithActions(actions=>
actions.Add(productionConfirm, c=>
c.WithConnotation(ActionConnotation.Secondary)))
.WithEventHandlers(handlers=>
{
handlers.Add<SOShipmentEntryCreditHoldExt>(g =>
g.OnCreditLimitSatisfied); //CS0029 -
//Error (active) CS0029 Cannot implicitly convert type //'PX.Data.WorkflowAPI.PXWorkflowEventHandler<PX.Objects.SO.SOShipment, //PX.Objects.AR.ARBalances>' to //'PX.Data.WorkflowAPI.PXWorkflowEventHandler<PX.Objects.SO.SOShipment>'
handlers.Add<SOShipmentEntryCreditHoldExt>(g=>
g.OnCreditLimitViolated); //CS0029 -
//Error (active) CS0029 Cannot implicitly convert type //'PX.Data.WorkflowAPI.PXWorkflowEventHandler<PX.Objects.SO.SOShipment, //PX.Objects.AR.ARBalances>' to //'PX.Data.WorkflowAPI.PXWorkflowEventHandler<PX.Objects.SO.SOShipment>'
});
});
//Graph PXWorkflowEventHandler
public class SOShipmentEntryCreditHoldExt : PXGraphExtension<SOShipmentEntry>
{
// other logic
public PXWorkflowEventHandler<SOShipment, ARBalances> OnCreditLimitViolated;
public PXWorkflowEventHandler<SOShipment, ARBalances> OnCreditLimitSatisfied;
}
//DAC Workflow Event
public class ARBalancesCreditHoldExt : PXCacheExtension<ARBalances>
{
public class MyEvents : PXEntityEvent<ARBalances>.Container<MyEvents>
{
public PXEntityEvent<ARBalances> CreditLimitViolated;
public PXEntityEvent<ARBalances> CreditLimitSatisfied;
}
}
If I change the PXWorkflowEventHandler to just
public PXWorkflowEventHandler<SOShipment> OnCreditLimitViolated;
public PXWorkflowEventHandler<SOShipment> OnCreditLimitSatisfied;
The .WithHandlers declaration of the handler throws this error:
Severity Code Description Project File Line Suppression State Details
Error (active) CS0029 Cannot implicitly convert type 'PX.Data.WorkflowAPI.PXWorkflowEventHandler<PX.Objects.SO.SOShipment>' to 'PX.Data.WorkflowAPI.PXWorkflowEventHandler<PX.Objects.SO.SOShipment, PX.Objects.AR.ARBalances>' NCRLog C:\Acumatica ERP\Acu\App_Data\Projects\NCRLog\NCRLog\Workflow\SOShipmentEntry_WorkflowExt.cs 210
I can tell i am doing something fundamentally wrong, but I have no clue what it could be, could anyone offer some help?