Attachment Name

Forums Dynamic Forms for SharePoint Attachment Name

Viewing 5 reply threads
  • Author
    Posts
    • #13867
      Pedro Ramos
      Participant

      Hi Alexander,
      Before to start thanks for response me the last issues I send. Now I got a question about to show the attachment name instead of attachment image, see the image for references. I know there’s a workaround to show the attachment name in a list view, using jquery (http://sharepoint.stackexchange.com/questions/146353/viewing-my-attachments)

      Thanks  🙂

      Attachments:
    • #13909
      Alexander Bautz
      Keymaster

      Hi,
      Add this to the “Custom JS”:

      function getAttName(a,item){
          var id = item.get_item("ID");
          $.getJSON("/DFFS/_api/lists/getByTitle('vLookup_list_name')/items("+id+")?$select=AttachmentFiles,Title&$expand=AttachmentFiles", function(data) {
              var b = [];
              $.each(data.AttachmentFiles,function(i,att){
                  b.push("<a href='"+att.ServerRelativeUrl+"' target='_blank'>"+att.FileName+"</a><br>");
              });
              $("#attLoader_"+id).replaceWith(b.join(""));
          });
          return "<img id='attLoader_"+id+"'>";
      }

      Than add the field “ID” to the “ViewFields” of your vLookup config, and add this to the “Special configuration”:

      {"function":"getAttName"}

      You must change the “/DFFS” part of the URL with the base url of the site where your vLookup list resides, and the “vLookup_list_name” with the display name of your child list.

      Please note that this code will work on SP 2013 only. I can make a snippet for SP 2010 on request.

      Alexander

    • #13943
      Pedro Ramos
      Participant

      Thanks for the code, but am getting the following error “Unclosed string” from JSHint. Let me confirm you i’m been using Sharepoint 2013

      Attachments:
    • #13946
      Alexander Bautz
      Keymaster

      Hi,
      Yes, this code is not right. It might be a browser issue. Do you see the code correctly in the code snippet in my previous post? – maybe you need to paste it in notepad and then cut it from there to ensure any formatting is not messed up.

      Alexandder

    • #13967
      Pedro Ramos
      Participant

      Hola,

      The code you sent was perfect the problem was the Outlook Email change the code. I took the code from the email and then start the problem.

      “+att.FileName+”<br>”
      ============================================================================
      (““+att.FileName+”<br>

      ==============================================================================
      Thank for the help

      Attachments:
    • #13970
      Alexander Bautz
      Keymaster

      Thanks for the feedback – I’m glad it worked out.

      Alexander

Viewing 5 reply threads
  • You must be logged in to reply to this topic.