Passing Arguments to Outcomes

An argument is a Key-Value Pair that passes into the Outcome defined in the EventRuleOutcomeTable.

EventRuleOutcomeID        Key        Value

Key is a string. Value is a string.

For Example:

  • Key = StatusId
  • Value = 2
if (outcomeContext.Arguments.TryGetValue("StatusId", out string status))
{
    if (Int32.TryParse(status, out int statusId))
    {
        _distributorService.SetAssociateStatus(outcomeContext.EventDataPoint.AssociateId, statusId);
    }
    else
    {
        _logger.LogWarning(Id, $"Invalid type for argument StatusId, cannot convert {status} to int. Rule {outcomeContext.Rule.Name}.");
    }
}
else
{
    _logger.LogWarning(Id, $"Expected argument StatusId not found. Rule {outcomeContext.Rule.Name}.");
}

As the example shows, use the TryGetValue for the Argument Key and TryParse for the Argument Value to validate the argument(s) that is(are) required for the Outcome.