Does anyone know how I can view the content of a file from the file cabinet by clicking on a custom body field without it automatically downloading? Trying to create a suitelet however getting an error and then once this works, what type of custom body field should it be and should it be a stored value?
/**
 * @NApiVersion 2.x
 * @NScriptType Suitelet
 * @NModuleScope SameAccount
 */
define(['N/file', 'N/ui/serverWidget'], function(file, serverWidget) {
  function onRequest(context) {
    if (context.request.method === 'GET') {
      var fileId = context.request.parameters.268180;
      var fileObj = file.load({
        id: fileId
      });
      var fileName = fileObj.name;
      var fileContent = fileObj.getContents();
      var fileType = fileObj.fileType;
      var response = context.response;
      response.setContentType(fileType, fileName, 'inline');
      response.write(fileContent);
    }
  }
  return {
    onRequest: onRequest
  };
});