``` submitFields(record.Type.VENDOR_BILL, r...
# suitescript
c
Copy code
submitFields(record.Type.VENDOR_BILL, recordId, rejReason);
    }
}

function submitFields(recordType, recordId, valueToSubmit) {
    try {
        return record.submitFields({
            type: recordType,
            id: recordId,
            values: {
                'custbody_reject_reason': valueToSubmit
            },
            options: {
                enableSourcing: false,
                ignoreMandatoryFields : true
            }
        });
invalid transaction type
a
remove the quotes
c
sorry - ignore the quote
I added those as I changed it to 'vendorbill' then changed it backed before pasting here
Looks like the field gets updated on the vendor bill anyway but the error is still thrown
a
you're sure that's the part that's throwing the error? based on the line # and stack trace? cos... I don't think record.Type VENDOR_BILL is a bad type 🙂
if you use 'vendorbill' instead does it also complain?
c
Same issue
a
you have the record module included in your define, right? think that would give a different error sooner in the process though in your script? and any library modules?
e
I would print the
recordType
param inside the function and see what is being received.
👍 1
c
It prints the expected type - I pasted the full script in the main channel.
a
Maybe a dumb suggestion but did you verify your record module is in fact pointing to the record module? I made that mistake a bit ago where I had record and another module flipped around in the order of instantiation and it was causing me headaches
c
Thanks for the suggestion, I rewrote the whole thing in the end as it wasn’t well designed.