0

api: assigning a task to someone?

Im having some difficulty assigning a task to a user, no problem creating it but it keeps throwing the error;

API create() Task.task_assignees expected [Array] data type(s) but got Hash:

{"type"=>"HumanUser", "id"=>45}#

 

this is my code:

createRendTaskData = { 'project': {'type':'Project','id':66},

'content': 'Please render',

'sg_status_list':'rdy',

'start_date': today,

'task_assignees': {'type':'HumanUser','id':45},

'step': {'type': 'Step', 'id':36},

'entity': {'type':entity,'id':entityResult['id']} }

 

createRendTaskResult = sg.create('Task',createRendTaskData)

 

taking the task_assignees out it works, and i cant seem to find any documentation on it either? It seems like its a silly mistake on my part but i cant figure it out.

cheers

2 comments

  • 0
    Avatar
    Lee

    ah got it now, should read the error properly, my mistake.

  • 0
    Avatar
    Ben Hadden

    Hi Lee, are you still having trouble with this?  task_assignees is a multi-entity field, so Shotgun expects a list.  If you add brackets around your entity hash like this:

    [{'type':'HumanUser','id':45}]

    It should work.  Let me know if it does.

Please sign in to leave a comment.