we are trying to create a customer payment via a s...
# ask-stanley-ai
i
we are trying to create a customer payment via a suitescript, and we are receiving an error of customer not found. However, our API user has access to the customer via SuiteQL, SOAP, and SuiteScript searches, and we can associate messages and notes to the same customer via suitescript. What could probably cause this?
c
AI generated answer (using internal Slack threads):
Based on the conversations, the error you're encountering while creating a customer payment via SuiteScript could be due to several reasons: 1. Invalid Data: Ensure that all the data you're using to create the customer payment is valid. This includes the customer ID, payment method, invoice ID, and invoice total. An invalid date was mentioned as a cause of a similar error in one of the conversations. 2. Incorrect Field IDs: Make sure you're using the correct field IDs when setting values. For example, in the provided SuiteScript, 'fieldId' is used instead of 'fieldId'. This could potentially cause an error. 3. Sublist Value Setting: Errors can occur when setting sublist values. Ensure that the sublist ID, field ID, value, and line are all correct and valid. In one of the conversations, an error was traced back to the setSublistValue function. 4. Record Creation: When creating the customer payment record, ensure that the type is set to 'CUSTOMER_PAYMENT' and that 'isDynamic' is set to false. Here's a snippet of the SuiteScript provided for reference:
Copy code
javascript
var payment = record.create({
    type: record.Type.CUSTOMER_PAYMENT,
    isDynamic: false
});

payment.setValue({
    fieldId: 'customer',
    value: customerId
});

payment.setSublistValue({
    sublistId: 'apply',
    fieldId: 'internalid',
    value: invoiceId,
    line:1
});
Remember to always check the error logs for more details on what might be causing the error. ****** 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.860873163
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.855743468
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.849284232
Please provide your feedback on this answer.