Updating a field with a timestamp

SOLVED

Hi

I have a tablescript that updates a field with a timestamp when its value changes. If I add/edit an address, phone number, email address I get an error. In principle, the tablescript should check the incoming data and compare it to the existing DB record. The error is "Company ManageCreditRatingChangeDate UpdateRecord jscript error: 'comp_creditrating' is undefined Line: 16 Char: 8" --- Line 16 = Line 8 of the script. The whole script contains the other 3 stub functions

This is pretty simple and the script below does this:

function UpdateRecord()
{
    var oComp = CRM.FindRecord('company', 'comp_companyid=' + CRM.GetContextInfo('company','comp_companyid'));
    var dtDate = new Date();
   
	if(comp_creditrating != oComp.comp_creditrating)
	{
		comp_creditratingdatetaken = dtDate.getVarDate();
	}
}

It seems if I edit one of the secondary entities linked to the company, the error occurs because the inbound data does not contain the comp_credtirating field. I tried checking to see if comp_creditrating != undefined but I still get the error.

Parents Reply Children
No Data