Hello,
we have some kind of problem with aprrovals object with our Scriptrunner listeners. In our case on TEST env we getting different ordering than on our PROD env.
list = ApprovalService.getApprovals(ApplicationUser, Query)
We are using list[0].getId().toString(), but in one case we get first object from list and in second case we get last object.
in TEST: PagedResponse from list we get ordering from first approval (L1) to last approval (L2)
in PROD: PagedResponse from list we get ordering from last approval (L2) to first approval (L1)
Environments are with same versions of JSW,JSM and Scriptrunner.
Do you know why is this happening?
You could try to run a sort() command in your list for bot instances to ensure that the values are sorted accordingly. For example:-
list.sort { it.created }[0].getId().toString()
I hope this helps to answer your question. :)
Thank you and Kind regards,
Ram
If both test & prod are exact same versions then I would assume it's not that there is any difference in the API.
Can you do a list.getClass() and see what the API returns? If it is an ArrayList then that does not guarantee the order of elements. Perhaps you might need to convert it to your own LinkedList based on some sorting mechanism. I can only see the javadocs for ApprovalService but can't dig into the source code right now to see how it fetches those approvals or which list subclass it uses.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.