tpettijohn
Scholar

Workflow Fails on Assign A Task [Error Code: Runtime.Internal]

Jump to solution

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 [[Attachment name]] to my text string variable, then save its new value back to the same text variable.
    example:
    <div><a href=https://SharePointSiteURL/Lists/ListName/Attachments/[[ItemID]]/[[Attachment name]]>[[Attachment 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. [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.

 

Thanks

Labels: (1)
0 Kudos
Reply
2 Replies
leighburke
Nintex Employee
Nintex Employee

Re: Workflow Fails on Assign A Task [Error Code: Runtime.Internal]

Jump to solution

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

View solution in original post

0 Kudos
Reply
tpettijohn
Scholar

Re: Workflow Fails on Assign A Task [Error Code: Runtime.Internal]

Jump to solution
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.
0 Kudos
Reply