How to loop though an ArrayList

The example below shows how we can ‘find’ users, then join them together CSV, to be then put in a multi-user picker field - in JEMH, all values are plain text.

Javadoc

When working with Jira, there is a lot of supporting javadoc available through the “Velocity Context” on the script edit page:

Example script

var n = userSearchService.findUsersByFullName("admin"); var recordCount = n.size(); print('record count: '+recordCount); var csv=''; for (var i = 0; i < recordCount; i++) { var aUser = n.get(i); csv+=aUser.getUsername(); if (i+1 < recordCount) { csv+=','; } } resultMap.put("MultiUserPicker", csv);