locked
Format filename as hyperlink or code to open it? RRS feed

  • Question

  • Hi

    We are building CRM 2011 Online system.

    We have a bespoke entity called Document with a field in it which holds path and filename for a file elsewhere on network folder eg  j:\folder\file.suffix

    Unfortunately i have tried to format the field as a hyperlink but it whinges if it does not start with http:// or ftp://

    Is there any javascript that will allow me to do this or alternatively simple code to add a button that will open the file?

    Cheers

    Mike


    Mike Kolling
    Friday, March 4, 2011 4:12 PM

Answers

  • file:// is not accepted as well.

    you can use the following method.

    1. Create a new field using Text format, named new_filepath for instance.

    2. Create a JScript web resource, using the following text

    function openfile()
    {
      var filepath=Xrm.Page.data.entity.attributes.get("new_filepath").getValue();
      window.self.open(filepath);
    }
    

    3. Define a button in the ribbon, use the webresource you just created for the button.

    4. On the form, type the file path in this format file://sharefolder/abc/mail.txt

    5. Then, by clicking the button, users can open the file specified in the new_filepath field.

     

     


    Please remember to click “Mark as Answer” on the post that helps you. Jackie Chen, Microsoft Online Community Support
    • Proposed as answer by I am Ben Tuesday, March 8, 2011 10:43 PM
    • Marked as answer by Michael Kolling Thursday, March 10, 2011 2:12 PM
    Monday, March 7, 2011 6:58 AM

All replies

  • have you tried file:/// as the protocol yet?
    Friday, March 4, 2011 9:45 PM
  • file:// is not accepted as well.

    you can use the following method.

    1. Create a new field using Text format, named new_filepath for instance.

    2. Create a JScript web resource, using the following text

    function openfile()
    {
      var filepath=Xrm.Page.data.entity.attributes.get("new_filepath").getValue();
      window.self.open(filepath);
    }
    

    3. Define a button in the ribbon, use the webresource you just created for the button.

    4. On the form, type the file path in this format file://sharefolder/abc/mail.txt

    5. Then, by clicking the button, users can open the file specified in the new_filepath field.

     

     


    Please remember to click “Mark as Answer” on the post that helps you. Jackie Chen, Microsoft Online Community Support
    • Proposed as answer by I am Ben Tuesday, March 8, 2011 10:43 PM
    • Marked as answer by Michael Kolling Thursday, March 10, 2011 2:12 PM
    Monday, March 7, 2011 6:58 AM