Setting or Updating Date Fields using a Table Level Script

Less than one minute read time.

This little tip shows how you can use a Table Level Script to set a value for a field that is not displayed on the screen.

In my example a customer needed to implement a business rule that when a user updates the company field 'Type' to be a Customer the system should then automatically updated a date field (comp_customerstartdate).

It may seem to be a catch that the date field is not displayed on the company screen. But this is something that can be easily handled by a Table Level script

You could you this code in an UpdateRecord event function


function UpdateRecord()
 // Handle update record actions here
var strOldType = CRM.GetContextInfo("company","comp_type");
var strNewType = Values("comp_type")
if (strOldType != strNewType  & & strNewType=="Customer")
var mydate = new Date(); 
mydate.setDate(mydate.getDate() +7); 
Values("comp_customerstartdate") = mydate.getVarDate();

  • I need to do this exact thing, but instead of updating the comp_customerstartdatedate, I want to update the case_closed date when a Case status is set to 'Resolved'. I've modified your example above for my situation and unable to get it to work. I even tried putting your example in just as a test to see if it would update the company start date and that didn't work either.

    Did something change since you posted this? We are on 7.2.b. and we are not using Workflows for cases so I need to get this to work as a table level script.