- Update the client script to send a GET HTTP request to a Suitelet that will run the search you want to run. Values can be passed using the URL parameters. For example:
https. get.promise({
url: stSuiteletUrl + ‘&orderId=’ + stOrder
}).then(function(response){
var objResponse = JSON.parse(response.body);
}).catch(function onRejected(reason) {
console.log(reason);
});
2. Create the Suitelet that will run the search. Make sure it is configured to run as an Administrator.
- URL parameters can be accessed using the
context.request.parametersargument. For example:
let stOrderId = scriptContext.request.parameters.orderId;
scriptContext.response.write({
output: JSON.stringify({
status: ‘success’,
results: arrResults
});
});