SY_WebhookSubscription.ItemNo
How is the value of SY_WebhookSubscription.ItemNo determined, because it looks like every row is getting the value of 1?
Db.ExecuteSql(@"INSERT INTO SY_WebhookSubscription (RecID, SY_WebhookSubscriber_RecID, EventName, URL, ItemNo, LastSavedDateTime)
VALUES (@RecID, @SY_WebhookSubscriber_RecID, @EventName, @URL, (SELECT COALESCE(MAX(ItemNo), 0) + 1 FROM SY_WebhookSubscription WHERE SY_WebhookSubscription.SY_WebhookSubscriber_RecID = @ItemNo_SY_WebhookSubscriber_RecID), SYSUTCDATETIME())", Db.ExecuteSql(@"INSERT INTO SY_WebhookSubscription (RecID, SY_WebhookSubscriber_RecID, EventName, URL, ItemNo, LastSavedDateTime)
VALUES (@RecID, @SY_WebhookSubscriber_RecID, @EventName, @URL, (SELECT COALESCE(MAX(ItemNo), 0) + 1 FROM SY_WebhookSubscription WHERE SY_WebhookSubscription.SY_WebhookSubscriber_RecID = @ItemNo_SY_WebhookSubscriber_RecID), SYSUTCDATETIME())",
new
{
RecID = newSubscription.RecID,
SY_WebhookSubscriber_RecID = newSubscription.SY_WebhookSubscriber_RecID,
EventName = newSubscription.EventName,
URL = newSubscription.URL,
ItemNo_SY_WebhookSubscriber_RecID = newSubscription.RecID
});