Help! Please! :-)
I have a requirement where I need to add a record to another table if certain fields on the company record change. I am using a table-level script to accomplish this. However, I am completely open to a better way to do this, if any.
I have created a function to handle the record insert (addTKsyncCompRecord()). Everything appears to be working as expected until I run across a field that has no value in it. It appears that the system compares nothing to NULL and sees them as different. Therefore, a record is added even though no change was actually made.
I am not sure how to get around this issue.
Any suggestions would be greatly appreciated!!
This is an example of my table-level script. This has been placed in the UpdateRecord area. To make it easier to read, I have removed some of the fields to compare.
if(CRM.GetContextInfo('company','comp_name') != Values('comp_name'))
{
addTKsyncCompRecord()
}
else if (CRM.GetContextInfo('company','comp_ae1') != Values('comp_ae1'))
{
addTKsyncCompRecord()
}
else if (CRM.GetContextInfo('company','comp_ae2') != Values('comp_ae2')) <<---failing here because there is no screen value and the database value is NULL
{
addTKsyncCompRecord()
}
else
{
//Do nothing
}
Again, any assistance would be greatly appreciated!