I added a field in the Sales Order named Membership that will source from the customer record. Then when that field is set to the membership level (ex. elite member) it automatically set the discount item field to a specific discount item…. I encountered a notif saying SuiteScript 2.x entry point scripts must implement one script type function how do I fix this?
/**
*@NApiVersion 2.x
*@NScriptType ClientScript
*/
define([“N/currentRecord”, “N/runtime”], function(currentRecord,runtime) {
function pageInit(context) {
const record = currentRecord.get() // Get value of Membership Field
const user = runtime.getCurrentUser().name
}
var membership = currentRecord.getField({
fieldId : "custentity1",
})
if(membership == "Elite"){
//Setting up discount
record.setValue({
fieldId: "discountitem", //fieldId of the Discount Item
value: 137 // Internal ID of the Discount Item
})}
else {
record.setValue({
fieldId: "discount item",
value: 0
});
}
return {
pageInit : pageInit
}
});