Skip to main content

What does the Employment Verification Workflow Definition look like?

workflows/employment_verification.go


// EmploymentVerification is a Workflow Definition that calls for the execution of a Side Effect, and an Activity,
// but then waits on and handles a Signal. It is also capable of handling a Query to get Candidate Details.
// This is executed as a Child Workflow by the main Background Check.
func EmploymentVerification(ctx workflow.Context, input *EmploymentVerificationWorkflowInput) (*EmploymentVerificationWorkflowResult, error) {
var result EmploymentVerificationWorkflowResult

err := workflow.SetQueryHandler(ctx, EmploymentVerificationDetailsQuery, func() (CandidateDetails, error) {
return input.CandidateDetails, nil
})
if err != nil {
return &result, err
}

researcher, err := chooseResearcher(ctx, input)
if err != nil {
return &result, err
}

err = emailEmploymentVerificationRequest(ctx, input, researcher)
if err != nil {
return &result, err
}
submission, err := waitForEmploymentVerificationSubmission(ctx)

result = EmploymentVerificationWorkflowResult(*submission)
return &result, err
}

Swim lane diagram of the Employment Verification Child Workflow Execution