should a negative journal entry appear on the appl...
# ask-stanley-ai
a
should a negative journal entry appear on the apply sublist of an already existing vendor payment transaction?
c
AI generated answer (using internal Slack threads):
Based on the conversations, a negative journal entry should not appear on the apply sublist of an already existing vendor payment transaction. The reason is that a journal entry is not a payment transaction and therefore cannot be applied to a vendor payment transaction in the same way a payment can. However, it is possible to use a journal entry to offset the amount due on a vendor bill. This is done by creating a journal entry that credits the Accounts Payable account and debits the appropriate expense account. The journal entry can then be applied to the vendor bill, reducing the amount due. Here is a sample code snippet that demonstrates how to apply a journal entry to a vendor bill:
Copy code
javascript
const make_billPayment_record = record.transform({
    fromType: billPayment.transactionType,
    fromId: billPayment.transactionId,
    toType: record.Type.VENDOR_PAYMENT,
    isDynamic: true
});
make_billPayment_record.setValue({ fieldId: 'apacct', value: chosenApAccount, ignoreFieldChange: false });
make_billPayment_record.setValue({ fieldId: 'currency', value: chosenCurrency, ignoreFieldChange: false });
const vendorBillLineNum = make_billPayment_record.findSublistLineWithValue({
    sublistId: 'apply',
    fieldId: 'internalid',
    value: billPayment['transactionId']
});
make_billPayment_record.selectLine({
    sublistId: 'apply',
    line: vendorBillLineNum
});
make_billPayment_record.setCurrentSublistValue({
    sublistId: 'apply',
    fieldId: 'apply',
    value: true,
    ignoreFieldChange: false
});
make_billPayment_record.setCurrentSublistValue({
    sublistId: 'apply',
    fieldId: 'amount',
    value: billPayment['paidAmount'],
    ignoreFieldChange: false
});
make_billPayment_record.commitLine({
    sublistId: 'apply'
});
const jeLineNum = make_billPayment_record.findSublistLineWithValue({
    sublistId: 'apply',
    fieldId: 'internalid',
    value: je_obj['transactionId']
});
make_billPayment_record.selectLine({
    sublistId: 'apply',
    line: jeLineNum
});
make_billPayment_record.setCurrentSublistValue({
    sublistId: 'apply',
    fieldId: 'apply',
    value: true,
    ignoreFieldChange: false
});
make_billPayment_record.setCurrentSublistValue({
    sublistId: 'apply',
    fieldId: 'amount',
    value: billPayment['paidAmount'] * -1,
    ignoreFieldChange: false
});
make_billPayment_record.commitLine({
    sublistId: 'apply'
});
const created_bp_id = make_billPayment_record.save({ ignoreMandatoryFields: true });
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830505371
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826660216
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82220459
Please provide your feedback on this answer.