I am using record.submitFields, and I keep getting...
# ask-stanley-ai
s
I am using record.submitFields, and I keep getting the error Missing a required argument: type when using "record.Type.CUSTOMER" as my type, but when I change it to 'customer', the script works. Why will this method not take the 'record.Type' field?
c
AI generated answer (using internal Slack threads):
The
record.submitFields
method in SuiteScript 2.0 requires the record type to be passed as a string. When you use
record.Type.CUSTOMER
, you are referencing an enumeration value, which is not a string. This is why you are getting the error "Missing a required argument: type". When you change it to 'customer', you are passing a string, which is the correct data type for the
type
parameter in the
record.submitFields
method. This is why your script works when you use 'customer' instead of
record.Type.CUSTOMER
. Here is an example of how to use
record.submitFields
correctly:
Copy code
javascript
var recordId = record.submitFields({
    type: 'customer',
    id: 123,
    values: {
        'custbody_reject_reason': 'Some reason'
    },
    options: {
        enableSourcing: false,
        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.851272881
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84478718
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.843270421
Please provide your feedback on this answer.