Expand my Community achievements bar.

Previous Document Version vs Newest Doc verions with Fusion?

Avatar

Level 2

Hi all,

 

Pretty new to fusion and trying to work out a new problem.

 

I think I am close but can't get it to work exactly.

I am looking to find the previous version of a document with Fusion, if the new version is greater than the previous version then run the scenario.

 

I have a different scenario that runs based of a watch event for new and update but was wondering if this alt route is possible?

 

I was able to get all the versions using a read related module on the document versions.

How would I filter for the last previous so I can assign it to a variable?

I tired something like this but I can't get it to work: Bundle order position = Total number of Bundles - 1

 

DanielSi1_0-1713299107511.png

 

 

Alternatively if there is a better way to pull the last version what would be the best module to use?

 

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Level 10

Hello Daniel,

 

as far as I know there is no build in function to get the most recent entry, but I think you can do the following:

 

1. Use the Array aggregator module to put your search results into an array

2. Combine the sort() and the map() functions to get the document versions in descending order

{{sort(map(229.array; "version"); "desc")}}

 3. Now you know, that the previous version always has the position 2 in your array and from there you can go on

 

To assign the version on position 1 (your previous version) to a variable you can use

Perhaps there is an easier way to solve your problem, but this is, what came into my mind at first.

{{get(232.testvar123; 2)}}

 

Regards

Lars

Avatar

Level 2

@DanielSi1 ,

I have done this by adding 'Watch Event' on Document, compare oldState.currentVersion with newState.currentVersion  , run scenario if both are not equal.