Client script date format issue

chrisp1
Mega Sage

We have some custom client scripts, that populate date fields by coping the values from fields on a referenced record, that are no longer populating the fields in the correct date format since upgrading to San Diego. The scripts were created 10 years ago and never been any issues.

System date format property is set to dd/MM/yyyy, but the script is now populating the fields in the format yyyy-MM-dd which gives an invalid date error when trying to save.

Here's an example script

function onLoad() {
   if (g_form.getValue('u_original_beneficial_use_date') == ""){
      var origBeneficialDate = g_form.getReference('u_project_number', getOrigBeneficialDate);

function getOrigBeneficialDate(origBeneficialDate){
  g_form.setValue('u_original_beneficial_use_date',origBeneficialDate.u_beneficial_use_date);
}

 

Anyone else experienced anything similar with San Diego and got a solution?

Any suggestions on how to rectify greatly appreciated

2 REPLIES 2

Frank Silveira1
Kilo Expert

Hello there,

 

I haven't faced any similar issue but I believe you can solve your issue by using the following:

.getByFormat('yyyy/MM/dd')

 

Best Regards

Thanks Frank, hadn't come across that method, unfortunately I couldn't find a way to return a value using it.

I've binned the original script and used scratchpad for the server lookup instead