Client script date format issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2022 06:49 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2022 07:08 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2022 06:06 AM
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