2

The ODATA REST API on SharePoint online doesn't provide for querying for a specific version of a list item. I have an app that can only interact with this API.

Accordingly, for a list in which I need to be able to obtain values for past versions, it seems I need to roll my own 'history' by using a workflow triggered on update of items, which copies the record either to the same list, or another list, with a version number.

I can do this, but can't figure out how to obtain the 'before' values (the values prior to the change constituting the update) within the workflow where I'm setting column values.

How can I get these 'before' values in a workflow that is triggered in an update?

1 Answer 1

4

The only way to achieve this with a workflow is to have an "old" column of the changed column.

For example, let's say you have a column called ColumnA and another called ColumnA_old. ColumnA_old will be a hidden column.

Your workflow is triggered when an item is changed. The changed value will be in ColumnA and the original value will be in ColumnA_old. At some point in your workflow you must set the value of ColumnA_old to be equal to the value of ColumnA, ready for the next time the item is changed.

To avoid ColumnA_old being blank the first time the item is changed, you should have a second workflow set to start when the item is created, whose sole purpose is to set the value of ColumnA_old to ColumnA.

Alternatively, you can use a coded solution with the use of event receivers.

1
  • Many thanks, I think this will suit my needs in this particular case.
    – sasfrog
    Commented Sep 10, 2015 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.