I am trying to add a user into a global group with global role in Polarion using workflow script by providing an input. Can you please help me how to call the below packages into workflow script?
- com.polarion.alm.shared.api.model.usergroup
- com.polarion.alm.shared.api.transaction
also, how to write the below code in workflow script?
TransactionalExecutor.executeInWriteTransaction(transaction -> {
UpdatableUserGroup updatableUG = transaction.userGroups().getBy().id("groupId").getUpdatable(transaction);
UpdatableUsersField updatableUsersField = updatableUG.fields()._users();
updatableUsersField.addUser("dummy_user");
updatableUsersField.addUser("dummy_user2");
updatableUG.save();
return null;
});
First of all, the workflow script functions are written in Javascript. The documentation of both API's provided by Polarion (rendering API and open API) might help you on that.
Also, an interesting site I have found is following: https://polarion.code.blog/category/technological/javascript/
There are quite interesting blog posts to see.
Second, I am not 100% sure, but I think that workflow functions might not allow WriteTransactions, especially on such high level (global administration). Better alternative might be the extension "Active Questionaire". That is based on SurveyIO, you can create your own "survey form" and eventually execute a JavaScript based on the inserted data.