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. I don't see those custom fields in the Pay Bills screen.
c
AI generated answer (using internal Slack threads):
To create a Bill Payment and set custom fields during creation, you would typically use SuiteScript. However, it's important to note that the custom fields may not be visible on the Pay Bills screen by default. You may need to customize the form to make these fields visible. Here's a basic example of how you might create a Bill Payment and set a custom field using SuiteScript 2.0:
Copy code
javascript
var record = require('N/record');

var billPayment = record.create({
    type: record.Type.VENDOR_PAYMENT,
    isDynamic: true
});

billPayment.setValue({
    fieldId: 'customform', // replace with your custom form id
    value: 123 // replace with your custom form id
});

billPayment.setValue({
    fieldId: 'entity', // replace with your vendor id
    value: 456 // replace with your vendor id
});

// Set custom field value
billPayment.setValue({
    fieldId: 'custbody_my_custom_field', // replace with your custom field id
    value: 'My Custom Value' // replace with the value you want to set
});

var billPaymentId = billPayment.save({
    enableSourcing: true,
    ignoreMandatoryFields: true
});

log.debug({
    title: 'Bill Payment Created',
    details: 'Bill Payment Id: ' + billPaymentId
});
Please replace 'custbody_my_custom_field', 'My Custom Value', 'customform', '123', 'entity', and '456' with your actual custom field id, the value you want to set, your custom form id, your actual custom form id, your vendor id, and your actual vendor id respectively. Remember to enable the custom fields in your form customization if they are not visible. ****** 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.842590213
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830810547
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830383301
Please provide your feedback on this answer.
Thank you for your feedback