Skip to content

Instantly share code, notes, and snippets.

@pupca
Created April 24, 2015 15:01
Show Gist options
  • Save pupca/faac32485c33c0149d14 to your computer and use it in GitHub Desktop.
Save pupca/faac32485c33c0149d14 to your computer and use it in GitHub Desktop.
var wi = workflowContext.getWorkItem();
var toField = arguments.getAsString("toField");
function log(msg) {
print("popelakm_log : " + msg + "\n")
// tail -f /var/log/polarion/polarion.log | grep popelakm_log
}
if (wi.getCustomField(toField) == null) {
var user = wi.getDataSvc().searchInstances("User", "id:" + wi.getDataSvc().getSecurityService().getCurrentUser(), "id").get(0)
var type = wi.getCustomFieldPrototype(toField).getType()
var enumFactory = wi.getDataSvc().getObjectEnumerationForEnumId(type, wi.getContextId())
wi.setCustomField(toField, enumFactory.wrapObject(user))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment