- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2014 02:01 PM
Hi there!
Nice to meet your acquaintance. I am running into a problem where I have an excel spreadsheet that has numbers formatted like this "8107463849" on the Excel spreadsheet, but I need them to be imported into a String field as "(810) 746-3849" without the quotes, and with a space between the ) and the 7.
I have been trying to come up with a way to do it, but I can't seem to get anything to work. I was trying to run it Onstart, as a New Transform Map Script (not the first one you see on the Transform Map form). I also looked into researching setting up the Phone Number in the System Properties and setting it to True with the glide UI, but the instance I am working with does not want this global. They want it only for this specific field.
This is also in Dublin.
Does anyone have something that does this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2014 01:51 PM
It is adaptable to a transform:
target.u_phone = formatPhone(source.u_phone);
function formatPhone(str) {
var area_code = str.slice(0,3);
var first_three = str.slice(3,6);
var last_four = str.slice(6,10);
var ph = "(" + area_code + ")" + first_three + "-" + last_four;
return ph;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2014 02:10 PM
Hi Kassandra,
You could achieve it using an onBefore Transform script.
code would be something like
target.u_phone = "("+source.u_phone.substring(0,3)+") "+source.u_phone.substring(3,10);
Hope that helps.
Thanks,
Mandar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2014 11:00 AM
Hi Mandar,
Thanks for your input! I tried to run it, it seemed to work with one record but then when I loaded in multiple, it is loading in as "2,394,939,432" as an example now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2014 11:56 AM
I'm not sure how SN would respond to forcing an integer to parse like a string. Try this:
var phone = source.u_phone.toString();
target.phone = "(" + phone.substring(0,3) + ")" + phone.substring(4,10);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2014 01:18 PM
Hi Kassandra,
Also make sure you're using onBefore transform script that runs for each row in import set, and not onStart transform script that runs once for a whole import set.
Thanks,
Mandar