Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Assign User especific in task

 Post Reply Post Reply
Author
belmar sigisfredo View Drop Down
New Member
New Member
Avatar

Joined: 20 Dec 2015
Posts: 13
Post Options Post Options   Quote belmar sigisfredo Quote  Post ReplyReply Direct Link To This Post Topic: Assign User especific in task
    Posted: 08 Dec 2016 at 3:04am
i resolved the problem change "UserId" by   "UserName"
Back to Top
belmar sigisfredo View Drop Down
New Member
New Member
Avatar

Joined: 20 Dec 2015
Posts: 13
Post Options Post Options   Quote belmar sigisfredo Quote  Post ReplyReply Direct Link To This Post Posted: 08 Dec 2016 at 2:57am
Originally posted by belmar sigisfredo

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;

Back to Top
belmar sigisfredo View Drop Down
New Member
New Member
Avatar

Joined: 20 Dec 2015
Posts: 13
Post Options Post Options   Quote belmar sigisfredo Quote  Post ReplyReply Direct Link To This Post Posted: 08 Dec 2016 at 2:54am
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;


Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2429
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 28 Nov 2016 at 4:58pm
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.
Back to Top
belmar sigisfredo View Drop Down
New Member
New Member
Avatar

Joined: 20 Dec 2015
Posts: 13
Post Options Post Options   Quote belmar sigisfredo Quote  Post ReplyReply Direct Link To This Post Posted: 28 Nov 2016 at 3:13am
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
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down