Table Level Script. After update, create a record on another table.

Help! Please! I am having an issue with a table level script. Below is the script I have in the function UpdateRecord() area. I expect 29 records to be created in the table DueDiligence and they do get created. However, the only field that populates with data is due_propertyid (because it is hardcoded).

I reviewed the logs. The SQL log shows nothing and the ewaresystem.log displays the following.... ExecuteTableLevelScript - error:Invalid filename. I am not sure what this error means. I ran the SQL statement on an asp page and displayed the field values on the screen with response.write. Therefore, I think the SQL statement is correct.

Hoping someone can tell me why none of the fields are populating from my query. Any assistance you can provide would be greatly appreciated!

if (prop_cs_stage == 'DueDiligence')

{
var mySQL = "SELECT * FROM vDueDiligenceItem";
var DDcklist = CRM.CreateQueryObj(mySQL,"");
DDcklist.SelectSql();

with(DDcklist)
{
while (!eof)
{
var DDrec=CRM.CreateRecord("DueDiligence");
DDrec.due_DDiligenceItemId = DDcklist.duim_DDiligenceItemId;
DDrec.due_propertyID = '222';
DDrec.due_description = DDcklist.duim_description;
DDrec.due_DocumentID = DDcklist.duim_DocumentID;
DDrec.SaveChanges();

DDcklist.NextRecord();
}
}
}

  • 0

    A fresh look today along with a look at the Developers Guide helped me to see the error of my way! :-) It appears I did not write the insert values correctly.

    I wrote it as DDcklist.duim_DDiligenceItemId

    I should have written it as DDcklist.FieldValue("duim_DDiligenceItemId)

    Hopefully my pain will be someones gain in the future! Thanks for the read!