1) Create a Suitelet that contains the server side function.
2) Deploy the suitelet and note the Script Id and Deployment Id.
Note: In this example, we delete a file using Suitescript. There is only one API that is used to delete the file, the nlapiDeleteFile(recId) function. You discover this function can only be used in a server side script, and you are using a client side script to develop your code.
{
var recId = request.getParameter('entity');
nlapiDeleteFile(recId);//server side only function
}
3) Use the script id and deployment id inside a client side script which contains the nlapiRequestURL(url) function. Pass any values required by the suitelet inside the url.
function client_requestSuitelet()
{
var url = nlapiResolveURL('SUITELET', 'customscript99', 'customdeploy1') + '&entity=101';
nlapiRequestURL(url);
alert('success');
}
No comments:
Post a Comment