Using Workflow, I want to update a field with the previous value of the field. Based on searching of answers.laserfiche.com I found the only way to do this was though scripting but I was not able to find any example scripts. The code I came up with is below...
Is this the correct way to get the version just prior to the latest version or is there a better way? (NOTE: I had to skip two because the latest field change has already been logged as a new version, so the previous value is actually in the version 2 back).
DocumentInfo doc = this.BoundEntryInfo as DocumentInfo; FieldValueCollection currentValues = doc.GetFieldValues(); var vh = doc.GetVersionHistory().OrderByDescending(v => v.Version).Skip(2).FirstOrDefault(); var fieldValue = vh.GetFieldValue(PAYABLE_STATUS_FIELDNAME); this.SetToken("OldStatusValue",fieldValue);