web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

stop the prefix "http://" from being added

(0) ShareShare
ReportReport
Posted on by 310

Is there anyway, that I can disable or stop the prefix "http://" from being added to the website field with the URL format? Thanks.

*This post is locked for comments

I have the same question (0)
  • Mounir Profile Picture
    310 on at

    any help please?

  • Suggested answer
    Royal King Profile Picture
    27,686 on at

    call below function in onload  of the form that will remove http from the url. THis will work only when user update/add value to website field. if you want to remove for exisitng record i uggest you to bulk update using export to excel.

    function removeHttp() {

       var website = Xrm.Page.getAttribute("websiteurl");

       if (website)

       {

           website.addOnChange(function () {

               var url = Xrm.Page.getAttribute("websiteurl").getValue();

               if (url && url.indexOf("http") > -1) {              

                   Xrm.Page.getAttribute("websiteurl").setValue(url.replace("http://", ""));

               }

           });

       }  

    }

  • Mounir Profile Picture
    310 on at

    It doesn't work.

    I tried An other solution: I applied the function removeHttp on the OnSave event of the form. The websiteurl field is saved without the http but when opening the account form, it always shows the http before the website url, even it saved without it.

  • Suggested answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    the URL format is a special one, a protocol must be specified and if it is missing or not a valid one, http:// is always added.

    allowed protocols are

    HTTP, HTTPS, FTP , FTPS, ONENOTE and TEL

    msdn: technet.microsoft.com/.../dn531187.aspx

  • Mounir Profile Picture
    310 on at

    Thank you.

    So, what I can do is to create a text field that replace the website url field. Is there a way to make the text field clickable (and blue if possible) ?

  • Verified answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    not using a supported customization, you need to create a custom webresource binded to your simple text field in order to create the hyperlink

  • Royal King Profile Picture
    27,686 on at

    I tested this in my online as well on-premise crm and it works all the time. It will  remove "http://" from records that are created newly or website field value changed. If you want to make the change for all existing record export the records into excel and remove the http:// and re-import it to crm.

  • Mounir Profile Picture
    310 on at

    It doesn't work Chitrarasan. I tried your solution many times.

    The explanation of Guido helped me but doesn't give the solution.

    Thank you.

  • Community Member Profile Picture
    on at

    The weird thing is this url field prefix always updating whenever the form loaded. It is happening even for read only forms (inactive) and asking permission to save it before exiting.

    Is anyone got a fix for this?

  • Suggested answer
    Community Member Profile Picture
    on at

    Yes, it is annoying that Microsoft added this functionality.  Put this in your form's script (I put it at the top outside of my on_load).  It will override the function used by CRM so that the URL doesn't get modified.  Because Microsoft can, and does, change non-sdk object model in cloud tenants without letting anyone know, you should be aware this function could change so that the override no longer works...solves the problem for now though.

    parent.validateUrlProtocol = function () { return 1;}

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans