cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
aak1
Nintex Newbie

Document Generation tag document with attachments

I'm testing out the document generation feature of Nintex Workflow. It works well, however, I can't figure out how to include attachments from a list item. I know that attachments can't be appended to the document generated, but can there be hyperlinks to those attachments?

Labels: (2)
0 Kudos
Reply
1 Reply
Community Manager Community Manager
Community Manager

Re: Document Generation tag document with attachments

Thanks for tinkering and trying it out. This may be a tad hard to achieve because SharePoint doesn't make it easy to get to the list item attachment URL. I've seen people use javascript and web request to grab that, but ithin a workflow directly you may be able to pull that off using the "call web service" action

 

Once you get the URL, you can store that within a variable, then you would output that value within the document you are generating so the link shows up as a clickable link in the word document or pdf. 

 

Here is a link to a solution for getting the URL - https://sharepoint.stackexchange.com/questions/157010/get-listitem-attachment-url

<script type="text/javascript">

$(document).ready(function() {

    // Rest URL
    var requestUri = "/_api/lists/getbytitle('Marketplace')/items?$select=SearchOffer,Category,Description,Price,ID,AuthorId,Attachments,AttachmentFiles,Title&$expand=AttachmentFiles";


        $.ajax({
            url: requestUri,
            type: "GET",
            headers: { "ACCEPT": "application/json;odata=verbose" },
            success: function (data) {

                $.each(data.d.results, function (i, item){
                    var title = item.Title;
                    var searchOffer = item.SearchOffer;
                    var category = item.Category;
                    var description = item.Description;
                    var price = item.Price;
                    var id = item.ID;
                    var authorId = item.AuthorId;
                    var attachmentUrl = item.AttachmentFiles.results[0];

                    //alert(attachmentUrl.ServerRelativeUrl);

                    document.getElementById("market" + i).innerHTML = "<img class='img-responsive' src=" + attachmentUrl.ServerRelativeUrl + " alt=" + attachmentUrl.FileName + "><h2>" + title + "</h2><p>" + description + "</p>";

                })
            },
            error: function () {
                alert("Error getting the Marketplace Items");
            }                     
        });
  });      

</script>

 

0 Kudos
Reply