Formatting Phone Numbers on CRM 2011 with extension numbers

Saran Jawaban Formatting Phone Numbers on CRM 2011 with extension numbers

  • 02 Desember 2011 0:31
     
     

    I have used the Jscript below to format phone numbers and it works fine unless you try to add an extension number eg 555-555-5555 ext 678. Does anyone have Jscript which allows you to also have extension numbers?

    Thanks in advance

    function

     

     

    var

     

    if (typeof (oField) != "undefined" && oField != null)
    {
    sTmp = oField.replace(/[^0-9]/g,
    ""

     

    switch

     

    case

     

    "(" + sTmp.substr(0, 3) + ")" + sTmp.substr(3, 3) + "-"

     

    break

     

    default

     

    "Phone must contain 10 numbers."

     

    break

    ;

    }

    }

    context.getEventSource().setValue(sTmp);

    }

    )

     

     

    :

    alert(

     

    ;

     

     

    + sTmp.substr(6, 4);

     

     

    10:

    sTmp =

     

    (sTmp.length)
    {

     

     

    );

     

     

    sTmp = oField;

     

     

    FormatPhoneNumber(context)

     

    {

    var oField = context.getEventSource().getValue();

Semua Balasan

  • 02 Desember 2011 5:30
     
     Saran Jawaban

    Hi,

    One method is to test if the phone number contains "ext" (oField.indexOf("ext") > 0), if it does, then strip out the all characters begining at e (sTmp = oField.substring(0, oField.indexOf("ext"))) the do your phone number check in sTmp

    or another idea is to create a custom field to store ext numbers. This way you won't need to make any changes to your Javascript.

    Hope this helps.

     


    Eric UNG [Senior Analyst Programmer :: Sydney, Australia]
    • Disarankan sebagai Jawaban oleh Philippe LEAL 07 Desember 2011 9:15
    •  
  • 14 Juni 2012 18:20
     
     

    Hi:

    I realize this is an old post, however we are having problems with CRM 2011 importing Outlook 2010  --  The issue we are trying to resolve:  


    Importing pre-formatted contacts from Outlook 2010 and/or entering American
    telephone numbers with a business extensions, ie:   (444) 555-6666 x7777777  ...  

    perfect example:  Microsoft employees have American 10-digit numbers with 7-digit extensions. 


    More specifically, (444) 555-6666 x7777777 with a single space between the 10-digit number and 'x', no space between 'x' and 7-digit extension.   


    Sorry I am not an experienced java-script-code professional, but I can certainly cut/paste and follow processes from YouTube tutorials  --  Does anyone have any suggestions? 

    Thank you in advance,

    Scott


    Scott