I achieved this using a workaround solution, as I was not able to access data from past versions of a list item without writing or installing custom workflow extensions for SharePoint Designer. My solution was to create a hidden text field in the list, which was updated using a separate workflow each time a change is made to the list item to replicate the "Append Text" functionality.
I left the original multiple line text field configured to append text to previous versions so that the historic entries of the text field could still be displayed in the standard display or edit form (the hidden field is not visible on edit/display fields as it should be manually edited by a user). The process of the workflow to append the new text to the hidden field was quite simple. I first used the "build a dynamic string" action to create a workflow variable that contained the past entries as well as the newly updated entry, including the modify date and modified by user for reference purposes. The next and final step is to update the hidden field with the value in the workflow variable only of the value in the two are not already equal. If they are equal when the worklow is initiated, the workflow will do nothing (stop). This is to help prevent the workflow from entering an indefinate loop for environments with SP1 or no service packs installed. This is because the process of updating the hidden field in the current list item can trigger a new instance of the workflow creating an endless loop. Incorporating a simple test into the logic to only update the hidden field if the new value is not equal to the existing value will prevent this from happening.
Now, when I need to use the the contents of the appended text field in a workflow, I can use the contents of the hidden field, which will contain the equivalent to the historic appended text field entries and not just the value from the most recent version.
Related:
- SharePoint Workflow Errors: Descriptions, resolutions and Workarounds
- How to configure a workflow to start at specific time, then loop / repeat periodically (Daily, Weekly)
- SharePoint Designer: Get account details of the user who initiated the workflow using OOB Workflow Activities
- SharePoint Looping Workflow - How to: Loop through and process all items in a list
- How to wait for a change in any list, wait for multiple field changes in the current item (SharePoint Workflow)
- (Looping) Timer Workflows Using SharePoint
- SPD Workflow - Test if value exists in any item in SharePoint list - create new item if not found
No comments:
Post a Comment