Magidoc

generateCustomerInvoiceDrafts
Mutation

Converts a selection of billing-approved worksheets into draft customer invoices, one per worksheet, by running generateCustomerInvoiceDraft for each. A worksheet that cannot convert is reported in results and leaves the rest of the selection untouched.

Access: Requires the finance feature and the billingInvoiceGenerate permission — the same permission generateCustomerInvoiceDraft enforces, asserted per worksheet. Ids are confined to workspaceId, so a worksheet in another workspace is reported as not found rather than by its status.

Errors: Throws when the user is not logged in, the workspace has finance disabled, the selection is empty, or it names more worksheets than one run allows. Everything a single conversion can refuse — a missing worksheet, a worksheet not yet billing-approved, an already-invoiced status mismatch, no billable lines, a payment-term problem — is reported per row in results rather than thrown.

Arguments

#

workspaceId

ID !
Non-null

worksheetIds

[ID !]!
Non-null

Response

#

Returns FinanceBulkMutationResult !.

Example

#