For anyone that has run into the SuiteScript cachi...
# suitescript
s
For anyone that has run into the SuiteScript caching bug, here's a little script I created that can work around the issue when it's occurring. @darrenhillconsulting helped me test it in an account that was experiencing the issue and it appeared to work! Deploy this script as a suitelet and run it any time you notice a caching issue when deploying scripts. It simply finds all JS files in the file cabinet modified in the last 10 mins and and forces them to update.
👌 3
Copy code
/**
 * @NApiVersion 2.x
 * @NScriptType Suitelet
 * @NModuleScope SameAccount
 */
define(['N/file','N/search'],

function(file, search) {

    function onRequest(context) {
		var fileSearch = search.create({
		   type: "file",
		   filters: [
		      ["modified","after","minutesago10"], 
		      "AND", 
		      ["filetype","anyof","JAVASCRIPT"]
		   ],
		   columns: [
		      search.createColumn({ name: "name" })
		   ]
		});
		var filesUpdated = 0;
	 	fileSearch.run().each(function(result){
			try {
				var fileObj = file.load({
				    id: result.id
				});
				fileObj.save();
				filesUpdated++;
			} catch (e) {}
			return true;
		});
	 	context.response.write('Files Updated: ' + filesUpdated);
    }

    return {
        onRequest: onRequest
    };

});