Unable to change date format on field mapping since Rome

Max Nowak
Kilo Sage

Hi,

On both my dev instance and the customer's instance, which are on Rome, I am unable to change the date format for a field mapping. The date format always resets to "yyyy-MM-dd HH:mm:ss", no matter what I enter, and I can see that this is done by the client script "Hide Date Format":

find_real_file.png

This client script should set the visibility of the "Date Format" field to true and set "yyyy-MM-dd HH:mm:ss" as a default value if the field "Target Field" changes, meaning it's an onChange client script with "target_field" as trigger field. The thing is, I don't get why the client script is triggering, I'm not changing the value in target_field, just the date format.

This leaves me unable to accept different date formats in imports. I mean, I could potentially use a source script and handle the issue there, but it seems to me that this is a bug introduced in rome.

Am I missing something here? Is this the same for you, or do I just have two broken instances?

1 ACCEPTED SOLUTION

Max Nowak
Kilo Sage

A quick update with an answer that worked for me:

This seems to be a display issue. If I enter a different date format, for example "dd-MM-yyyy HH:mm", it will save this date format  (verifyable in the XML), but it will always display the default "yyyy-MM-dd HH:mm:ss". If I click "save" on the record, it will actually save the default format "yyyy-MM-dd HH:mm:ss".

So, if anyone else has this problem, a workaround is to change the date format, save it, and never touch the record again. You should be able to verify via Show XML that the date format has changed, even though it might still display the default format.

View solution in original post

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

did you compare the script against Quebec?

Here is the script from Quebec

function onChange(control, oldValue, newValue, isLoading) {
   var table = new Table(g_form.getValue('target_table'));
   if (isLoading)
      newValue = oldValue;

   var el = table.getElement(newValue);
   var displayChoiceAction = false;
   if (el && (el.type == "glide_date" || el.type == "glide_date_time" || el.type == "datetime" || el.type == "date"))
      displayChoiceAction = true;

   g_form.setDisplay('date_format', displayChoiceAction);
}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

shloke04
Kilo Patron

Hi,

It works for me. Can you make sure when you are defining your field map have you selected the Date Format field value as well as shown below:

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hi,

My instance is Build name: Sandiego
Build date: 03-17-2022_1811

 

For me the date format is not showing and everything seems to be okay but i am not sure why  still its not showing. pls suggest if any solution

 

Max Nowak
Kilo Sage

A quick update with an answer that worked for me:

This seems to be a display issue. If I enter a different date format, for example "dd-MM-yyyy HH:mm", it will save this date format  (verifyable in the XML), but it will always display the default "yyyy-MM-dd HH:mm:ss". If I click "save" on the record, it will actually save the default format "yyyy-MM-dd HH:mm:ss".

So, if anyone else has this problem, a workaround is to change the date format, save it, and never touch the record again. You should be able to verify via Show XML that the date format has changed, even though it might still display the default format.