I am trying to create a Cash Sale, and want to use...
# suitescript
b
I am trying to create a Cash Sale, and want to use one of the credit cards a customer has stored. In the UI, if I select a credit card it fill in some of the values. In suitescript it is not working. I am setting the 'creditcard' field to be the internal id of the credit card record. Is there a different process to do that? I am in dynamic mode
b
what does the code look like and what fields do you want to be sourced
b
I am trying to set the credit card select field, and the rest should be filled in.
cashSale.setValue({ fieldId: "creditcard", value: SCOConstants.paymentMethod });
b
sharing one line doesnt help
especially in dynamic mode
share enough code to reproduce the problem
ideally only enough code to reproduce the issue
b
Copy code
var cashSale = record.create({
                    type: record.Type.CASH_SALE,
                    isDynamic: true
                });
                if(requestBody.useCreditCard){
                    cashSale.setValue({
                        fieldId: "creditcard",
                        value: SCOConstants.paymentMethod
                    });
                }
b
thats not how dynamic mode works
you need to set the fields in the same order you would in the ui
in the ui you would not set the creditcard field first
b
Copy code
var cashSale = record.create({
                    type: record.Type.CASH_SALE,
                    isDynamic: true
                });
                cashSale.setValue({
                    fieldId: "entity",
                    value: requestBody.customerId
                });
                cashSale.setValue({
                    fieldId: "location",
                    value: SCOConstants.LOCATIONS.BYUSTORE
                });
                cashSale.setValue({
                    fieldId: "shipmethod",
                    value: SCOConstants.SHIP_METHODS.PICK_UP_IN_STORE
                });
                if(requestBody.useCreditCard){
                    cashSale.setValue({
                        fieldId: "creditcard",
                        value: SCOConstants.paymentMethod
                    });
                }
b
you will need to share how SCOConstants works
b
Its simply a set of predefined variables, SCOConstants.SHIP_METHODS.PICK_UP_IN_STORE = the internal id of that ship method
b
too simple
the credit card select field is not the list of payment methods
the payment method field is the list of payment methods
b
Thats it. Thanks for adding an extra pair of eyes