Any clue on this issue ?

Jean Couteau a écrit :
> Dear all,
>
> I have a class with a UserList attribute. I am trying to add users to 
> this list from an other page with no success. I try using the following 
> code :
>
> #if($joinTask!="")
>   #set($taskDoc = $xwiki.getDocument("Project.${joinTask}"))
>   #set($taskObj = $taskDoc.getObject("XWiki.TaskClass"))
>   #set($list = $taskObj.get("assignedPeople"))
>   $list.add($xwiki.getUser())
>   $taskObj.set("assignedPeople", ${list})
>   $taskDoc.save()
> #end
>
> but $list.add does not exist so I tried differently :
>
> #if($joinTask!="")
>   #set($taskDoc = $xwiki.getDocument("Project.${joinTask}"))
>   #set($taskObj = $taskDoc.getObject("XWiki.TaskClass"))
>   #set($list = $util.getArrayList())
>   $list.add($xwiki.getUser())
>   $taskObj.set("assignedPeople", ${list})
>   $taskDoc.save()
> #end
>
> but I have a casting exception.
>
> I had a look on the velocity website, on this list archives,... with no 
> success
>
> My question is : Can I add users like that or the only way is through 
> the edit panel and if yes, what is my mistake ?
>
> Best regards,
>
> Jean
>
>   


-- 
----
Jean Couteau
Code Lutin - http://www.codelutin.com
44 Bd des Pas Enchantés - 44230 St-Sébastien/Loire
Tél : 02 40 50 29 28 - Fax : 09 59 92 29 28 

_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to