I've created a couple of scripts that create custo...
# suitescript
w
I've created a couple of scripts that create customer/vendor payments. Currently I use dynamic mode to create the records, set the account, subsidiary, currency, etc. in the right order to get the right bills/invoices in the sublist and then find the right line and update it. . Is it possible to apply payments using standard mode?
b
standard mode is forced to use defaultValues to prepopulate the apply sublists
for example you can use the
vendorbills
default value to populate the apply sublists on a vendor payment
dynamic mode has the option of just using sourcing, but usually you end up using the default values anyways when you start encountering badly maintained accounts with thousands of unpaid bills or when there are user filters hiding bills
w
Do you have any readingmaterial on the default values? We're transforming a bill to a bill payment and then need to update some values. The default values in record.transform() didn't like ‘currency’ for instance?
vendor primary currency: 1 vendor bill currency: 8 subsidiary currency: 7 vendor bill amount due: 1000 what I need to pay: 500
Copy code
var rec = record.create({
    type: record.Type.VENDOR_PAYMENT,
    isDynamic: false,
    defaultValues: {
        subsidiary: 26,
        entity: '3335280',
        vendorbills: '6706319',
    }
})
Above will give me a record without any lines in the apply sublist. As the primary currency of the vendor is different from what the bill is, I need to change it. Adding currency: 8 to the default values gives me "You have entered an invalid default value for this record transformation operation." Even if the vendor primary currency was the same as the bill, the sublist would be empty. How would I change the payment amount?
m
A trick I learned from battk is to check the url parameters in the UI and use them as default parameters
w
Yeah, I took that lesson too. And currency do work as a url parameter, but not as defaultValue. 😄
b
if you cant default the currency, you will be stuck with dynamic mode