Customer Engagement & Dynamics CRM Forum

Expand all | Collapse all

URL text field and linking to local file path

  • 1.  URL text field and linking to local file path

    Posted 15 days ago
    Based on the existing posts I've seen I think I know the answer to this, but I'm hoping the CRM wizards here have an idea I can try. This is for CRM 8.2 on-premise.

    I've got a client who is migrating from a locally-hosted system and they've got a file server hosting a lot of documents and images. Their current system allows for a local path that, when clicked by the end user, opens a shared folder on their file server in the user's browser.

    I'm hitting a wall trying to do this in CRM with a URL type of text field. I'm using the URL type since the text needs to be clickable. The problem is that, since v8, a URL-type text field will automatically append "http://" to the front of the string. This behavior converts my local path:
    \\server\share\folder\folder\etc

    Into an unusable path like:
    http://\\server\share\folder\folder\etc

    Other CRM forums have noted that the only way around this might be custom javascript in a web resource that strips out that prefix:
    https://dynamics365blog.nl/2017/08/23/ignore-added-https-text-field-type-url/

    Is that truly the only workaround for removing that http:// prefix, or the only option for a hyperlink in a CRM field that doesn't include that prefix?

    Side note - I already tried creating it as a calculated field, but CRM won't let me save the calculated field's formula with a \ in it.

    Thanks!

    ------------------------------
    Mike Cutlip
    RAMCO
    www.RAMCOAMS.com
    Durham, NC
    ------------------------------


  • 2.  RE: URL text field and linking to local file path

    Posted 15 days ago
    The official URI scheme for a local file is file://, but it looks like Dynamics still puts https in front of this.

    I think you're stuck here, either use a standard text field, use a custom control or something fancy in an onretrieve plugin (not sure this would work).

    Sorry!

    ------------------------------
    Ben Bartle
    IBM
    ------------------------------



  • 3.  RE: URL text field and linking to local file path

    GOLD CONTRIBUTOR
    Posted 14 days ago
    Probably a bit of a long shot, but isn't there an IIS setting (or something) that enables you to make a local server web-accessible? (it could still be inaccessible externally)
    So instead of trying to fix the URLs, fix the server so that the URLs work?

    ------------------------------
    Donal McCarthy
    BrightWork
    Galway
    ------------------------------



  • 4.  RE: URL text field and linking to local file path

    Posted 14 days ago
    It's worth some research, Donal. Thanks!

    ------------------------------
    Mike Cutlip
    RAMCO
    www.RAMCOAMS.com
    Durham, NC
    ------------------------------



  • 5.  RE: URL text field and linking to local file path

    Posted 14 days ago
    Edited by Chad Devlin 14 days ago
    We have several UNC directories linked in CRM. Our implementation is on prem, but I don't' see why this would not work in the cloud. We accomplished this by populating a URL field using a post-retrieve plugin and then with javascript on the related (in our case account) form, turned the field label for the UNC path into a button which navigates to the specified URL. The plugin builds the UNC path it using a \\server\share\ path from a custom entity called globalparameters. (This allows us to change the directories without updating the plugin.) adds yyyy-mm\ and then our internal account number. We have different account types for divisions within our organization and each has it's own UNC destination. You'll see this in the included files.

      You'll need to use IE for local file access get a plugin for Chrome or Firefox. I can't take credit for the code, just the idea. It's a bit more work, but saves an incredible amount of time.

    ------------------------------
    IT Stuff
    Salem OR
    ------------------------------

    Attachment(s)

    txt
    UNC_Button.txt   6K 1 version
    txt
    UNC_path_plugin.txt   4K 1 version


  • 6.  RE: URL text field and linking to local file path

    TOP CONTRIBUTOR
    Posted 14 days ago
    Mike

    You can create a simple rest service that does the search by unc and return a binary string which can be consumed by Crm.

    I did this using nodeJS and expressJS that goes out and looks for the unc pdf file and returns the binary string.

    Cheers!

    ------------------------------
    Rex Kenley Tan, MCP
    Tallmadge OH
    https://www.youracclaim.com/users/rex-kenley-tan

    *Always be CURRENT with JavaScript & C#, NEVER be obsolete.

    DISCLAIMER: All views expressed on this site are my own and DO NOT represent the opinions of ANY entity whatsoever with which I have been, am now, or will be affiliated.
    ------------------------------



  • 7.  RE: URL text field and linking to local file path

    Posted 13 days ago
    Several good options in here to investigate further. Thanks for the tips, all!


    ------------------------------
    Mike Cutlip
    RAMCO
    www.RAMCOAMS.com
    Durham, NC
    ------------------------------