Retrieving notes from tasks

You know those notes that can be added to tasks using Workspace ES? (If you don’t, you can take a look at Working with notes and attachments). The Workbench ES help explains how to retrieve those notes as a document value after the form is submitted, but (believe it or not) the help leaves out a few details about how to reference the information in those notes.

Notes have a title and a body (the text of the note) which you may want to extract and use in the process. As explained in the Document attributes for attachments and notes topic in Workbench ES Help, when a file or a note is attached to a task, a document value is created to represent the attachment or note. You use document attributes in XPath expressions to access information about the attachment or note.The topic in the Workbench ES help did a pretty good job of describing how the attributes are used for attachments, but not so good for notes. Here are the attributes to use to access note titles and body text:

wsfilename: The note titlewsdescription: The note text

For example, a process creates emails from notes that are attached to tasks – the note title is used as the email subject, and the note body text is used as the email body. The notes and attachments of the task are saved in a list variable named attachmentVar. For a document value that represents a note, the following XPath expressions evaluate to the title of the note and the note’s body:getDocAttribute(/process_data/attachmentVar[1],”wsfilename”)getDocAttribute(/process_data/attachmentVar[1],”wsdescription”)Don’t forget to first determine whether the document value represents an attachment or a note. You use the wsattachtype attribute to do that.The following process uses the Set Value service to determine whether the document is a note, and if it is a note it uses the Set Value service again to extract the note title and body, and then uses the Email service to create the email message (click the image to see a larger view).process.gifThis process only checks one item in the task’s document list. A more robust process would use a loop to check all of the documents.

VN:F [1.9.22_1171]
Was this helpful? Please rate the content.
Rating: 0.0/10 (0 votes cast)

Comments are closed.