Assign User especific in task

Hi, i need assign one uses especific in task, i try add variable but to do run thi do error in user..., the user in variable is valid, but this can?t run task.

thanks

Hello, please give details about what and how you are trying to accomplish what you're trying to do. Nevertheless, usually the way to set the task user programmatically (before the task is created) is to put a variable name between brackets in the assigned user field (when creating the task definition):


[MyTaskUser]

and then from workflow you just need to set the value of that variable before the task block is executed (usually using a script block before the task block):

MyTaskUser := Some_User_ID;

note that the value of the variable must be the user id.

http://stna.cl/images/suporttms/task_definition.jpg
hi, i do this definition variable (link)

i do this code before run, this do error....

var wdf : TWorkflowDefinition;
    WorkIns: TWorkflowInstance;
    WFUsuario,WFEmail: TWorkflowVariable;
begin
     result:='';
     wdf := dmWorkFlow.WorkflowStudio.WorkflowManager.FindWorkflowDefinitionByName('Recepcion');
     if Assigned(wdf)
     then
     begin
          WorkIns:=dmWorkFlow.WorkflowStudio.WorkflowManager.CreateWorkflowInstance(wdf);
          WFUsuario:=WorkIns.Diagram.Variables.FindByName('Usuario');
          WFEmail  :=WorkIns.Diagram.Variables.FindByName('Email');
          dmWorkFlow.WorkflowStudio.WorkflowDB.WorkflowInstanceUpdate(WorkIns);
          result:=WorkIns.key;
          dmWorkFlow.WorkflowStudio.WorkflowEngine.RunWorkflow(WorkIns);
     end;




correction, this is a correct code used

function TDmWorkFlow.CreaWFRecepcion(Usuario, EMail: String): String;
var wdf : TWorkflowDefinition;
    WorkIns: TWorkflowInstance;
    WFUsuario,WFEmail: TWorkflowVariable;
begin
     result:='';
     wdf := dmWorkFlow.WorkflowStudio.WorkflowManager.FindWorkflowDefinitionByName('Recepcion');
     if Assigned(wdf)
     then
     begin
          WorkIns:=dmWorkFlow.WorkflowStudio.WorkflowManager.CreateWorkflowInstance(wdf);
          WFUsuario:=WorkIns.Diagram.Variables.FindByName('Usuario');
          WFUsuario.Value:=Usuario;
          WFEmail  :=WorkIns.Diagram.Variables.FindByName('Email');
          WFEmail.value:=EMail;
          dmWorkFlow.WorkflowStudio.WorkflowDB.WorkflowInstanceUpdate(WorkIns);
          result:=WorkIns.key;
          dmWorkFlow.WorkflowStudio.WorkflowEngine.RunWorkflow(WorkIns);
     end;
end;

i resolved the problem change "UserId" by   "UserName"