Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Exercise: Import Date, Enforce Mandatory, and Coalesce

KaustubG
Kilo Contributor

I'm working on 

Exercise: Import Date, Enforce Mandatory, and Coalesce

I have an issue with the 
  1. Set the Date format for the u_must_have_by Field Map.

    1. In the Transform Map, scroll to the Field Maps related list.
    2. Click the u_must_have_by link in the Source field column of the Field Map.
    3. Change the Date format to MM/dd/yy.
    4. Click the Update button.

Unable to find the Date format mentioned above. I can see MM-DD-YY which is gives me incorrect results when I Run Transform map. Can anyone assist me with this?

2 REPLIES 2

Jake Sadler
Kilo Sage

Use a source script like this

var mustHave = source.u_must_have_by;
var gdt = new GlideDateTime();
gdt.setDisplayValue(incomingDateStr, "MM/dd/yy");

var mustHaveDate = gdt.getDate()

Abhisheks144151
Tera Contributor

Hi

The Date format on the u_must_have_by Field Map must match the date in the import data. For this exercise, enter MM/dd/yy exactly rather than selecting the suggested MM-DD-YY.
Save the Field Map, reload the import data, and run the transform again. If the date is still wrong, check the actual u_must_have_by value in the staging table and make sure the Date format matches it.

Hope it works.