I have a form that allows users to upload attachments. I can add the attachments to a SharePoint Online list via a workflow and the SP Add Attachments to List action.
I need to Assign Task to individuals where they must review the list item attachments and approve or reject them.
I can easily add the actual Attachments to an email or Task notification via the form’s File Upload (Collection). However, I don’t see much sense in sending attachments via email, especially since they already exist in the SP online list. I would rather send the Task notification email with links to the attachments instead.
Unfortunately I have not found a simple way of doing that. The SharePoint Get Attachments action only works if the attachments existed in the list prior to starting the workflow. I seem to be unable to add the attachments during the workflow, then get their names and/or URLs, even if I re-query the list after the attachments were added.
Anyway, it occurred to me that I don’t need to actually get the attachment URLs from the list. I can build it if I just know the names of the attachments. The format for the attachment URL is:
So I can build the attachment URL if I know the Site URL, List Name, Item ID, and the Attachment Name.
So, I set out to do just that in a Nintex Workflow Cloud Workflow that uses a start Form.
I created the form (see attached pdf file)
The form for my Proof of Concept Test is very simple. Just a “Data Lookup” control to a SharePoint list and a “File Upload” control. The list just has a Title field and accepts attachments.
The workflow (see same attached pdf file)
The workflow is rather simple as well.
All of this works fine. I can add the attachments in the form, get the correct list item ID, add the attachments to the correct SP List item, and even build a valid URL to the attachments, and send an email with the clickable links to the list item attachments. The email works. It contains valid links to the list item attachments.
The workflow however fails when it reaches an “Assign a Task” or “Assign a task to multiple users” action. I get the following error message:
The workflow has failed unexpectedly. [Error Code: Runtime.Internal]
Any idea what is causing the “Assign a Task” actions to Fail?
See the attached pdf file for some screen shots of the form and the workflow.
Solved! Go to Solution.
The issue for me was that I was using AD to select the person who should be assigned the task. This person often wasn't registered as a Nintex Workflow Cloud user.
My solution (until we find a better one), is to replace the 'assign a task' step with an email containing a link to a new workflow. When the person is asked to log in to this second workflow, they're created as a Nintex Workflow Cloud User.
I pass any relevant data from the previous workflow over as querystring parameters, including the previous workflow's instance ID, so I can relate the data when I save it to the database.
For anyone having a similar error message when [Assign(ing) a Task], go to [Settings > User Lookup Directory] and create a connection to your AD.
The issue for me was that I was assigning tasks to users that didn't already exist in NWC. Usually new users are only registered when logging into a form, but if they're assigned a task before their user exists within NWC, you get this error. Setting up the [User Lookup Directory] connection allows Nintex to [Assign a Task] directly to AD details (registering that person in the background) without them needing to physically sign in, and without crashing the workflow