I ended up getting an answer to the question based off of Ola's private message. Below is my script in C#.
SqlConnection sqlConnection = new SqlConnection();
sqlConnection.ConnectionString = "your connection string"
IDataSet dataSet = ruleContext.DataSet("customersDataSet"); //ruleContext is the variable that is passed through the event handler. It is Interface type IRuleContext.
List<string> dataList = new List<string>();
//Setup the connection parameters
SqlCommand cmd = new SqlCommand();
cmd.Connection = sqlConnection;
cmd.CommandText = "your sql query";
reader = cmd.ExecuteReader();
for(int i = 0; i <= dataList.ToArray().Count() - 1; i++)
rec = dataSet.CreateRecord();
rec.AddValue("Customer", dataList[i]); //need to specify the column name in the data set here.
catch (Exception ex)
I have this code running through a script applied to a specific field on the document definition. Although this code will update the data set properly, there are a few issues I have found. First, for whatever reason every script in the document definition will make this script execute, even though it is only specified on one control's rule. Second, the iteration of dataSet.AddRecord(rec) takes an extraordinary amount of time. To process 150 records it takes longer than 1 minute to run the for statement.