Does anyone call RESTlets to get a record before? ...
# suitescript
j
Does anyone call RESTlets to get a record before? wanted to get a Credit card charge by using an external ID. Any idea on how to create one suitescript for it will be appreciated.
b
does your account use payment instruments?
j
hi @battk, not sure what is payment instruments but I can check with my netsuite admin. My use case is to call custom action to retrieve an existing credit card charge and create one if it is new. Based on community post, credit card charges is not accessible via web services. What needs to be done is creating a custom script (scheduled) to run the saved search.
b
standard credit card information is a sublist on a customer record
j
I am able to get a sample script for create, am wondering is it possible to do a get records
var salesOrder = r.create({
type: r.Type.SALES_ORDER,
isDynamic: true,
defaultValues: Date.now().toString
}).setValue({
fieldId: "entity",
value: customer
})
salesOrder.selectNewLine({ sublistId: "item" });
salesOrder.setCurrentSublistValue({
sublistId: "item",
fieldId: "item",
value: itemId
});
salesOrder.setCurrentSublistValue({
sublistId: "item",
fieldId: "quantity",
value: 5 });
salesOrder.commitLine({ sublistId: "item" });
salesOrder.save({
enableSourcing: true,
ignoreMandatoryFields: true
})
b
payment instruments allows for a separate record for payment cards
keep in mind that you should be very precise with your wording here, credit cards and credit card charges are different things
j
Copy code
standard credit card information is a sublist on a customer record
Sorry what I referring to is the credit card charge, it seems under vendor
b
A Credit Card Charge is a transaction. it supports all the normal operations on server suitescript which includes searching or <https:/system.netsuite.com/app/help/helpcenter.nl?fid=section_4267255811.html|loading>.
if this is your first script your first step will probably be Setting Up Your SuiteScript Environment followed by the SuiteScript 2.0 API Introduction (especially the SuiteScript 2.0 Hello World)
After that you probably want to look at <https:/system.netsuite.com/app/help/helpcenter.nl?fid=section_4387799403.html|SuiteScript 2.0 RESTlet Script Type>, especially SuiteScript 2.0 Getting Started with RESTlets
j
Yes this is my very first script, thanks @battk for so much useful link, i will learn it one by one