From 8a8ce76c01a6a1fe3c854d5155d2f23237f5ddf7 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 6 May 2026 11:48:34 +1000 Subject: [PATCH 1/3] AP-8362 # Added approvalFormPrefillMappings --- typescript/approvals.d.ts | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/typescript/approvals.d.ts b/typescript/approvals.d.ts index 734bec90..a70102c1 100644 --- a/typescript/approvals.d.ts +++ b/typescript/approvals.d.ts @@ -2,6 +2,42 @@ import { MiscTypes } from '..' import type { ConditionalPredicate } from './conditions' import type { EndpointConfiguration, IdResource } from './misc' +/** Container kinds that appear in {@link FormApprovalPrefillElementPath.containers}. */ +export type FormApprovalPrefillPathContainerKind = 'repeatableSet' | 'form' + +/** + * One nesting level from the form root toward a field (repeatable set row or + * nested form submission object). + */ +export type FormApprovalPrefillPathSegment = { + kind: FormApprovalPrefillPathContainerKind + /** `id` of the repeatable set or nested form element */ + formElementId: string +} + +/** + * Locates a field in the form tree: outermost container first, then the leaf + * element that holds the submission value. Repeatable sets are **not** scoped + * to a single row — prefill copies **every** source row to the same index on + * the target repeatable set. + */ +export type FormApprovalPrefillElementPath = { + containers: FormApprovalPrefillPathSegment[] + /** Leaf element `id` (must have a `name` used in submission). */ + formElementId: string +} + +/** + * Maps one source field path to one approval field path. Repeatable set levels + * must align with repeatable sets on the other side; nested form (`form`) + * wrappers may appear on only one side (extra `form` segments are skipped when + * aligning). + */ +export type FormApprovalFormPrefillMapping = { + sourcePath: FormApprovalPrefillElementPath + approvalPath: FormApprovalPrefillElementPath +} + export type FormApprovalFlowNodeBase = { /** The unique label for the node */ label: string @@ -9,6 +45,11 @@ export type FormApprovalFlowNodeBase = { group: string /** The id of a form that should be submitted with approval */ approvalFormId?: number + /** + * Prefill the approval form from the original submission when the approver + * opens it. Requires {@link FormApprovalFlowNodeBase.approvalFormId}. + */ + approvalFormPrefillMappings?: FormApprovalFormPrefillMapping[] /** Configuration to hide the deny button on approval actioning screens */ hideApprovalDenyButton?: boolean } From f4abfd0fcd67b0773e5d71b9ed452e5ab744351e Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 6 May 2026 16:08:21 +1000 Subject: [PATCH 2/3] AP-8362 # Added approvalFormPrefillMappings to BaseFormSubmissionApproval --- typescript/approvals.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/typescript/approvals.d.ts b/typescript/approvals.d.ts index a70102c1..5e5a3aa6 100644 --- a/typescript/approvals.d.ts +++ b/typescript/approvals.d.ts @@ -243,6 +243,11 @@ type BaseFormSubmissionApproval = { updatedBy?: string /** The id of a form that should be submitted with approval */ approvalFormId?: number + /** + * Prefill the approval form from the original submission when the approver + * opens it. Requires {@link FormApprovalFlowNodeBase.approvalFormId}. + */ + approvalFormPrefillMappings?: FormApprovalFormPrefillMapping[] /** The id of a form that should be submitted with approval */ additionalNotes?: FormSubmissionApprovalNote[] /** The id of a submission that was submitted with approval */ From 2def53d46e569d00abdd0795ba8962f98f67107c Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Thu, 7 May 2026 09:19:57 +1000 Subject: [PATCH 3/3] Apply suggestion from @mymattcarroll --- typescript/approvals.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typescript/approvals.d.ts b/typescript/approvals.d.ts index 5e5a3aa6..979834f5 100644 --- a/typescript/approvals.d.ts +++ b/typescript/approvals.d.ts @@ -245,7 +245,7 @@ type BaseFormSubmissionApproval = { approvalFormId?: number /** * Prefill the approval form from the original submission when the approver - * opens it. Requires {@link FormApprovalFlowNodeBase.approvalFormId}. + * opens it. Requires {@link BaseFormSubmissionApproval.approvalFormId}. */ approvalFormPrefillMappings?: FormApprovalFormPrefillMapping[] /** The id of a form that should be submitted with approval */