02-22-2024 05:37 PM - edited 02-22-2024 05:53 PM
I have data from salesforce that contain fields with a suffix of '__c' and the dates are formatted in UTC. I want to format the incoming data using the mapValue and the mapKey functions to remove the suffix and make all fields lower case AND format the dates into US/Eastern timezone.
I cant get the code to do all that I want: I have the following configuration n my mapper with a $ as my target:
$.mapKeys((value, key)=>key.endsWith('__c') ? key.replace('__c','').toLowerCase() :key.toLowerCase()) && $.mapValues((value, key) => key.toLowerCase().search("createddate") >=0 && value !=null ? Date.parse(value).toLocaleDateTimeString({"timeZone":"US/Eastern"}) :value)
This logic formats the dates but not the columns If I reverse it the columns are formatted and not the dates. Same thing if I change the && to ||. How can I get both transformations? Please help!
Solved! Go to Solution.
02-23-2024 02:07 AM
Try with this expression:
$.mapKeys((value, key)=>key.endsWith('__c') ? key.replace('__c','').toLowerCase() :key.toLowerCase()).mapValues((value, key) => key.toLowerCase().search("createddate") >=0 && value !=null ? Date.parse(value).toLocaleDateTimeString({"format":"yyyymmdd"}) :value)
02-23-2024 06:33 AM
Thank you so much! It worked!
02-23-2024 02:07 AM
Try with this expression:
$.mapKeys((value, key)=>key.endsWith('__c') ? key.replace('__c','').toLowerCase() :key.toLowerCase()).mapValues((value, key) => key.toLowerCase().search("createddate") >=0 && value !=null ? Date.parse(value).toLocaleDateTimeString({"format":"yyyymmdd"}) :value)
02-23-2024 06:33 AM
Thank you so much! It worked!
02-23-2024 06:33 AM
Thank you so much!!! It worked!