Nintex 2010 Workflow LazyApproval and Inline Functions – fn-Substring explained
I recently completed an update to a workflow to enable LazyApproval. Seemed easy enough to do. There’s just a checkbox in the Flexi-task. I found that after I enabled the feature and a user approved the workflow task by replying to the email that the workflow was erroring out. After the approval request was approved or declined, the workflow was updating some fields in the InfoPath form in the form library. Four promoted fields in an InfoPath form library – three single line of text fields and a date field. Here is the error:
The workflow could not update the item, possibly because one or more columns for the item require a different type of information.
Outcome: Unknown
This was puzzling because if the user approved the task via the Task Form, all fields were updated successfully. I started to think the issue was with the Date field but discovered it was actually with the Approvers Comments field. When the user replies via email with a LazyApproval, the approvers comments are the entire email. In my case, the contents of the email exceeded the limit of the Single Line of Text field. Since this InfoPath field was promoted as a SharePoint field I wasn’t able update the field type to accommodate this by changing the column data type in the List Settings page. This ended up breaking the InfoPath form when I tried to publish an update. InfoPath indicated the field mapping had changed. Enter the fn-Substring Inline Function.
So having just narrowed down the issue to the number of characters being passed back to the field in the InfoPath Form Library I thought the use of the Inline Function fn-Substring would take care of it. Well, not quite. I decided to declare a workflow variable (single line of text) and set it equal to the results of the inline function fn-Substring. Here’s what that looked like…
fn-Substring({Common:LastApproverComments}, 0, 200)
first variable: Approvers Comments, second variable: 0 – start at the first character, third variable: 200 – include the first 200 characters. I figured this would be enough.
If text used for a function argument contains function syntax (i.e. a brace or comma character) wrap the argument with {TextStart} and {TextEnd} to indicate a block of text that should not be parsed further.
Thank you!! This helped me greatly!!