How to create a Bill Payment and set custom fields...
# ask-stanley-ai
a
How to create a Bill Payment and set custom fields of that bill payment on Create? It requires me to also have at least one sublist line populated before it will save, but when I try to set fields in the Apply sublist then it throws Invalid Sublist Operation errors.
c
AI generated answer (using internal Slack threads):
To create a Bill Payment and set custom fields, you can follow these steps: 1. Open a Payment record 2. Customize the form 3. Click on New Body Field 4. Set the configuration - Label: [field name] - Type: [field type] - Store Value: is checked - Applies To subtab: Customer Payment is checked 5. Click Save & Apply to Forms 6. Look for the Custom Form for the Payment Record 7. Put a check 8. Click Save 9. Open the Payment Record on Edit mode 10. On the Apply subtab, click Customize button 11. Look for the [field name] custom field that was created 12. Put a check 13. Click Save For setting fields in the Apply sublist, you need to be careful with the indexing. In your loop, lines should start from index 0. Also, you cannot use
.setValue
to set a sublist value. You might be mixing up dynamic and standard mode. Here is a sample code snippet:
Copy code
javascript
var linecount = customerPaymentRecord.getLineCount('apply');
for(var i = 0; i<transactionIdsCount; i++){
    var internalId = customerPaymentRecord.getSublistValue({
        sublistId   : 'apply',
        fieldId     : 'internalid',
        line        : i
    });
    for(var j = 0; j<linecount; j++){
        var IndividualTransactionId = splitter[j];
        if (internalId === IndividualTransactionId){
            customerPaymentRecord.setValue({
                sublistId : 'apply',
                fieldId   : 'apply',
                line      : i,
                value     : true
            });                        
            customerPaymentRecord.commitLine({ sublistId: 'apply'});
        }
    }
}
****** 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.850891113
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.846435547
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.844726682
Please provide your feedback on this answer.
Thank you for your feedback
a
I just get invalid sublist operation errors. Also this needs to happen on Create, not for existing Vendor Payments