diff --git a/docs/docs/05-developer-guide/08-wfspec-development/08-user-tasks.md b/docs/docs/05-developer-guide/08-wfspec-development/08-user-tasks.md index 9a4fb3809..f765ffaec 100644 --- a/docs/docs/05-developer-guide/08-wfspec-development/08-user-tasks.md +++ b/docs/docs/05-developer-guide/08-wfspec-development/08-user-tasks.md @@ -208,7 +208,27 @@ wf.scheduleReminderTask(userTask, delaySeconds, taskDefName, taskArg1, taskArg2) -GoLang support for user tasks coming soon. +```go +func QuickstartWorkflow(wf *littlehorse.WorkflowThread) { + // Declare an input variable and make it searchable + nameVar := wf.AddVariable("input-name", lhproto.VariableType_STR).Searchable() + + // Execute a task and pass in the variable. + wf.Execute("greet", nameVar) + + arg1 := "This is the first argument passed to the reminder task" + arg2 := "This is the second argument passed to the reminder task" + delaySeconds := 10 // wait 10 seconds after the task is assigned to schedule the reminder + reminderTaskDefName := "email-group" + + userTaskOutput := wf.AssignUserTask("my-user-task", nil, "some-group") + wf.ScheduleReminderTask(userTaskOutput, delaySeconds, reminderTaskDefName, arg1, arg2) +} +``` + + + +Python docs for user tasks coming soon. diff --git a/sdk-go/littlehorse/wf_lib_internal.go b/sdk-go/littlehorse/wf_lib_internal.go index 2e50d8c1b..c459e32d2 100644 --- a/sdk-go/littlehorse/wf_lib_internal.go +++ b/sdk-go/littlehorse/wf_lib_internal.go @@ -244,7 +244,7 @@ func (t *WorkflowThread) reassignUserTaskOnDeadline( func (t *WorkflowThread) scheduleReminderTask( userTask *UserTaskOutput, delaySeconds interface{}, - taskDefName string, args ...interface{}, + taskDefName string, args []interface{}, ) { t.checkIfIsActive() diff --git a/sdk-go/littlehorse/wf_lib_internal_test.go b/sdk-go/littlehorse/wf_lib_internal_test.go index 4385620ec..cc7ed0e2b 100644 --- a/sdk-go/littlehorse/wf_lib_internal_test.go +++ b/sdk-go/littlehorse/wf_lib_internal_test.go @@ -100,6 +100,27 @@ func TestUserTaskWithOnCancellationExceptionName(t *testing.T) { assert.Equal(t, "no-response", utNode.GetOnCancellationExceptionName().GetLiteralValue().GetStr()) } +func TestReminderTaskArgs(t *testing.T) { + argForReminderTask := "some-arg-that-is-string" + wfObj := littlehorse.NewWorkflow(func(t *littlehorse.WorkflowThread) { + uto := t.AssignUserTask("some-user-task", "some-user", "some-group") + + t.ScheduleReminderTask(uto, 20, "some-task", argForReminderTask) + }, "somem-workflow") + + putWf, err := wfObj.Compile() + if err != nil { + t.Error(err) + } + + entrypoint := putWf.ThreadSpecs[putWf.EntrypointThreadName] + node := entrypoint.Nodes["1-some-user-task-USER_TASK"] + utNode := node.GetUserTask() + assert.NotNil(t, utNode) + reminderAction := utNode.Actions[0] + assert.Equal(t, argForReminderTask, reminderAction.GetTask().Task.Variables[0].GetLiteralValue().GetStr()) +} + func TestReminderTask(t *testing.T) { wf := littlehorse.NewWorkflow(func(t *littlehorse.WorkflowThread) { userVar := t.AddVariable("user", lhproto.VariableType_STR)