Issue with formatting date on target field via transform map
This content was last updated in 2023. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2023 08:32 AM - edited 08-09-2023 08:38 AM
Hi,
I'm trying to set 3 target fields on the Computer class which are all of type date via the SNOW transform maps. When the source data is transformed I was getting the error 'Unable to format 2028-11-10 using format string dd-MMM-yyyy for field u_refresh_date'. Same error for each of the fields. I therefore updated the date format in the field map to 'dd-MM-yyyy' which matches our system default. I tried setting the date format to ''dd-MMM-yyyy' but again got the error above.
When I loaded the data again the fields were populated but the date formatting was wrong. See below:
Date set -
Date from source -
I would therefore expect, am trying to set, the date would appear as 29-Jul-2028.
This is the source script:
answer = (function transformEntry(source) {
var targetRefreshDate = (source.u_comp___refreshdate.getDisplayValue());
return targetRefreshDate;
})(source);
Anyone see where i'm going wrong?
Steven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2023 08:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2023 08:50 AM
Thanks for the suggestion @Community Alums
I've just updated the source script to:
answer = (function transformEntry(source) {
var targetRefreshDate = (source.u_comp___refreshdate.getDisplayValue());
formattedTargetRefreshDate = targetRefreshDate.getByFormat("dd-MMM-yyyy");
gs.log("SNOW refresh formatted date - " + formattedTargetRefreshDate);
return formattedTargetRefreshDate;
})(source);
Will let you know once we're re-processed the data.
Steven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2023 09:19 AM
Hello @Steven Watts2
Plz mark my solution as Accept and give thumbs up, if you got any help from it.
Regards,
Samaksh