Forum Discussion

snapation6713's avatar
snapation6713
New Contributor III
2 years ago
Solved

Issue using mapValues and mapKeys functions in Mapper Snap

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...
  • SpiroTaleski's avatar
    2 years ago

    snapation6713 

    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) 
  • snapation6713's avatar
    snapation6713
    2 years ago

    Thank you so much!  It worked!