diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index 87d4bc29e4c8..ad3db18f7ca2 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -721,23 +721,33 @@ function IOURequestStepConfirmation({ const currentTransactionReceiptFile = transaction?.transactionID ? receiptFiles[transaction.transactionID] : undefined; - // If we have a receipt let's start the split expense by creating only the action, the transaction, and the group DM if needed - if (iouType === CONST.IOU.TYPE.SPLIT && currentTransactionReceiptFile) { - if (currentUserPersonalDetails.login && !!transaction) { - startSplitBill({ - participants: selectedParticipants, - currentUserLogin: currentUserPersonalDetails.login, - currentUserAccountID: currentUserPersonalDetails.accountID, - comment: trimmedComment, - receipt: currentTransactionReceiptFile, - existingSplitChatReportID: report?.reportID, - billable: transaction.billable, - reimbursable: transaction.reimbursable, - category: transaction.category, - tag: transaction.tag, - currency: transaction.currency, - taxCode: transactionTaxCode, - taxAmount: transactionTaxAmount, + if (iouType === CONST.IOU.TYPE.SPLIT && Object.values(receiptFiles).filter((receipt) => !!receipt).length) { + const currentUserLogin = currentUserPersonalDetails.login; + if (currentUserLogin) { + transactions.forEach((item, index) => { + const transactionReceiptFile = receiptFiles[item.transactionID]; + if (!transactionReceiptFile) { + return; + } + const itemTrimmedComment = item?.comment?.comment?.trim() ?? ''; + + // If we have a receipt let's start the split expense by creating only the action, the transaction, and the group DM if needed + startSplitBill({ + participants: selectedParticipants, + currentUserLogin, + currentUserAccountID: currentUserPersonalDetails.accountID, + comment: itemTrimmedComment, + receipt: transactionReceiptFile, + existingSplitChatReportID: report?.reportID, + billable: item.billable, + reimbursable: item.reimbursable, + category: item.category, + tag: item.tag, + currency: item.currency, + taxCode: transactionTaxCode, + taxAmount: transactionTaxAmount, + shouldPlaySound: index === transactions.length - 1, + }); }); } return;