Skip to main content
Nintex Community Menu Bar

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:
https://SharePointSiteURL/Lists/ListName/Attachments/ItemID/AttachmentName

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.

  1. Start Event is a Form (described above)
  2. I query the SharePoint Online List, then set variables for List Item ID, and List Item URL.
  3. I then created an Action Set to iterate through the File Upload collection, add the attachments to the SharePoint Online List, and extract the attachment name and add it to a text variable.
  4. In the Action Set, I use the “Create a text string” action and save it as a text string variable.
  5. The trick is that the Text String is an HTML <table> with <div> and <a href> tags so that I can build the URL path to the list item attachment.
    example:  <table>
  6. I then use “Loop for each” action to iterate through the “File Upload” Collection containing the attachments added to the form.
  7. Inside the Loop, I use the SharePoint Online “Add Attachment to an item” action
  8. Then I add the name of the current attachment example:
    <div><a href=https://SharePointSiteURL/Lists/ListName/Attachments/psItemID]]/oiAttachment name]]>AtAttachment name]]</a></div>
    and then save the string variable back to itself.
  9. Repeat steps 7 & 8 until there are no more attachments to add to the SP List.
  10. Once the loop is complete, I close the text sting variable (html table).
    example: </table>
  11. I can then send an email with the text string variable embedded in it, providing a list of attachment names with clickable links to the attachment in the SharePoint List.

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. oError 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.

 

Thanks

@tpettijohn As you are getting an error I would suggest reaching out to support(support@nintex.com) for this issue.


FYI
I opened a support case and they provided steps to resolve my issue.

From Support:
Can you please follow the next steps:
- Open the workflow
- Open the configuration for the assign a task action
- Design the form
- Make any change to the form, e.g. modify some text or add a label control. This will force the connection to the workflow to be regenerated
- Save the form
- Publish the workflow

Those steps resolved my issue.

Hi tpettijohn



 



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.



 



Alan


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


Reply