set assigne field

Description
kevin1119
Posts: 9
Joined: Tue Mar 20, 2018 3:27 am

set assigne field

Postby kevin1119 » Wed Jan 23, 2019 5:42 am

hi all, i'm pretty newbee to scripting in Polarion
as i understand, assignee field is an out of the box Polarion field; not a custom field.
in javascript, i try to set it by calling workitem.setvalue("assignee","my name");
i get this error "List field can never be set"

is that how it's supposed to be?
what data type is assignee?

another option that i can think of is create a new custom list field to work around

micdal
Posts: 22
Joined: Thu Feb 09, 2012 6:22 am

Re: set assigne field

Postby micdal » Wed Jan 23, 2019 6:22 am

Hi,

try using addAssignee(IUser participant). This "adds a user to the list of assignees." as described in the API documentation.

Regards,
Michael

kevin1119
Posts: 9
Joined: Tue Mar 20, 2018 3:27 am

Re: set assigne field

Postby kevin1119 » Wed Jan 23, 2019 6:43 am

thanks micdal for suggestion
im trying to copy a user from a custom field of type list ENUM/USER to assignee
i know i have to convert string value to IUser but don't know how to instantiate IUser. can you help?

scharph
Posts: 8
Joined: Wed Jul 04, 2018 9:19 am
Location: Austria

Re: set assigne field

Postby scharph » Wed Jan 23, 2019 7:07 am

Maybe this helps

Code: Select all

#set( $projectsService = $trackerService.getProjectsService())

#foreach( $user in $projectsService.getUsers() )
   >> $user.id - $user.getDescription().getContent() \\
#end


or this

Code: Select all

#set( $assignee = $projectService.getUser($userid))
#set( $dummy = $newWorkitem.addAssignee($assignee))


and maybe this

http://forums.polarion.com/viewtopic.php?f=5&t=97834&p=54443#p54443

best regards

kevin1119
Posts: 9
Joined: Tue Mar 20, 2018 3:27 am

Re: set assigne field

Postby kevin1119 » Wed Jan 23, 2019 8:05 am

thanks for your help, i got it to work using this approach

var enumOption = orkitem.getCustomField("fieldName");;
workitem.addAssignee(projectService.getUser(enumOption.getId()));


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 8 guests