To create a document expectation in an execution engine plan use the following snippet
var docexpLandlordsSolicitorConfirmation = function(ev, ctx, log) {
//use an allocation rule to get the correct participant to assign
var allocateOdsId = actions.sharedo.GetAllocatedOdsId(ctx.sharedoId, "es-repg-allocate-to-matter-owner");
log.Information("Allocating document expectation task to " + allocateOdsId);
var landsolRole = Helpers.getParticipantForSharedoByRole(ctx.sharedoId, "landlords-solicitor");
ctx.landsolRoleId = landsolRole ? landsolRole.participantId : "";
var taskBuilder = actions.sharedo.BuildTask()
.WithTitle("Confirmation Landlord's Solicitor Instructed")
.OfType("task-activity-document-expectation")
.ForSharedo(ctx.sharedoId)
.Assign("primary-owner").To(allocateOdsId)
.WithAttribute("FromRecipientId", ctx.landsolRoleId)
// .OnComplete("setKeyDateLandlordSolicitorConfirmation")
.WithProcessTag("REPG-SURR-DRAFT-005")
.OnPhase("task-activity-document-expectation-filed", "setKeyDateLandlordSolicitorConfirmation")
.WithTag("Documents and Negotiation")
.DueOn(actions.sharedo.AddWorkingDays(DateTime.UtcNow, 5))
.Save();
};