I am not sure if this is a new feature / bug or if it was always there. Microsoft support couldn't explained this behaviour eventually saying it was beyond their support boundary (SharePoint Online).
I create a new folder (content-type-ID = Folder) in a document library using Create New Item activity.
At this point, I can use Created variable returned by the activity to reference the newly created item in an Update Item activity. All good. However if I want to store this new ID for future use things gets complicated. My intuition is to put Created into an Integer variable and store in a list field. But strangely, this integer conversion returns a different value from the actual ID of the newly created item.
If I just create one folder and convert its created output to integer I end up with actual ID minus one, however if I create 5 folders in quick succession, the value I get after integer conversion is actual ID - 5.
Is there a reliable way to get the actual ID of the new item into an integer variable ?
EDIT: Also, interestingly, folders created by SDP 2010 workflows have final IDs increasing by two. So a single workflow, creating a single folder. If I run it twice I get IDs 10 and 12 (while 9 and 11 is returned if a convert create variable to integer). MS explained this as a "hidden folder" being created.
No such issue with 2013 workflows, GUID is returned, and I can get actual ID by referencing the item using its GUID. And it gets increased by one every time, not two.