Nintex for SharePoint Forum
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Hello!
I would like to include a list attachment on my Nintex Task Form. I tried using a hyperlink reference to the Item URL, and this does take me to where I can open the List attachment, but then I lose the Task Form and have to go back to the email to open it again.
I also tried the label control and configuring it so it would open the Link to the Item Property = Attachments, but that ends up taking me to a page that cannot be displayed.
Is there a way to add a control to the Task Form to show the List Item attachments?
It just seems to make sense to me to be able to click and open an attachment when performing an approval task.
Thank you!
Solved! Go to Solution.
Check this out: How do you add an attachment link to an approval task form
Thank you for your response. Unfortunately, this link did not resolve the issue. So far, it appears that Nintex is unable to incorporate list attachment links to the Nintex Task Form. I think this can be done using the SharePoint default task form though.
Criss Chang - Did you able to resolve the issue ? I have similar requirement. Client wants to see list item attachments on Task form before approving the request. Any thoughts?
Thanks,
Rahul
I ended up using javascript in order to get a list into my task forms. Add the following code to your in your task form settings under Custom JavaScript.
function getListItemAttachments(SiteURL, ListName, ItemID) {
if (ItemID) {
var queryUrl = SiteURL + "/_api/web/lists/getbytitle('" + ListName + "')/items(" + ItemID + ")/AttachmentFiles";
NWF$.ajax({
url: queryUrl,
type: "GET",
async: false,
headers: { "accept": "application/json; odata=verbose" },
success: onQuerySuccess,
error: onQueryError
});
} else {
NWF$(".nf-attachments_rich_text").html('<i>No attachments.</i>');
}
}
function onQuerySuccess(data) {
var BuildHTML;
var CountItems;
BuildHTML = '';
CountItems = 0;
if (data) {
//alert(JSON.stringify(data, null, 4));
if(data.d) {
NWF$(".nf-attachments_rich_text").html("1");
NWF$.each(data.d.results, function(key, value) {
BuildHTML = BuildHTML + '<a href="' + this.ServerRelativeUrl + '" target="_blank">' + this.FileName + '</a><b' + 'r />';
CountItems = CountItems + 1;
});
BuildHTML = BuildHTML.substring(0,BuildHTML.length - 6);
NWF$(".nf-attachments_rich_text").html(BuildHTML);
} else {
NWF$(".nf-attachments_rich_text").html('<i>No attachments.</i>');
}
}
if (CountItems = 0) {
NWF$(".nf-attachments_rich_text").html('<i>No attachments.</i>');
}
}
function onQueryError(error) {
alert(error.statusText);
}
Then I added a form variable name GetAttachments. Set the formula for the variable to the following and use insert reference to replace with the Site URL and List Name common items.
getListItemAttachments(Site URL,List Name,{ItemProperty:ID})
The last step is to add a Rich Text form control and change the CSS class to nf-attachments_rich_text.
I am getting "Forbidden" error at ajax call when i use the above code. I am using office 365. Could anyone please suggest how can i resolve the issue ?
Thanks Jeremiah Powers. Let me give it a try.
: Let me also try. I also have office 365 I might hit the same issue. Did you able to find any solution ?
Quick update: Developer tool is showing error -- required Cross Origin Resource Sharing (CORS)
Earlier in O365 it was not allowed but since 2015 CORS calls are fine. Don't know how to resolve.