Jira Cloud Script: I got a custom field (text) named "KB Number" readonly field. The field should be filled on a certain workflow transition (post function). I need to get the highest previously used number so far in other issues of the same JIRA project and increase the KB number of the current issue by 1.
Background: The idea is to generate some sort of sequential KB number based on different versions or customfield value .
Example: Version 1 - Script generates New KB Number starts with 1 (eg: 12345)
For version 2 - Script generates New KB Number starts with 2 (eg: 22355)