It’s possible to make a call from an SCS website frontend to the backend via a suitelet.
There may be security implications to calling a suitelet from the frontend. Please consult your Team Lead before attempting this,
This gives you the ability to get information from the backend, load, edit and create records, call other scripts, and do pretty much anything else you’d need to do.
How to implement this:
First, write your suitelet.
The important thing to note is that we are writing our information to the context object passed into the onRequest function. This is the information that will actually be returned by restlet.
/**
* @NApiVersion 2.x
* @NScriptType Suitelet
*/
define(['N/log', 'N/record'], function testLog(log, record){
'use strict';
function onRequest(context){
var customerRecord = record.load({
type: record.Type.Customer,
id: '34'
});
var name = customerRecord.getField({
fieldId: 'name'
});
context.response.setHeader({
name: 'Content-Type',
value: 'application/json'
});
context.response.write(JSON.stringify(name));
}
return {
onRequest: onRequest
};
});
In the script’s deployment record:
Ensure the Available Without Login is checked.
Under the Audience subtab, check the ALL ROLES box.
copy the external URL for the script, but leave off the domain. The final URL should look something like this.

Next call the Suitelet from your front end application.
This is accomplished through an AJAX request, so be sure to import JQUERY into your code.
for the url field, paste the external url from the script deployment record.
callRestlet: function () {
try {
var request = {
url: '/app/site/hosting/scriptlet.nl?script=418&deploy=1&compid=TSTDRV2209561&h=8502fc67cfe4fe204ec7',
type: 'get',
dataType: 'json',
headers: {
'Access-Control-Allow-Origin': '*'
}
};
} catch (e) {
console.log("error on creating request", e);
}
var completed = $.ajax(request)
.then((result) => {
console.log("result", result);
})
.fail((error) => {
console.log("oops", error);
});
console.log("completed", completed);
},
Be sure to implement try/fail procedures for the request, as AJAX requests are prone to failure.