Monday, July 15, 2019

Create a SuiteScript that will Refresh and Redownload the Page and Contents

1. Create a Client Script (Customization > Scripts > Workflows > New > Client)
Name: Refresh Cache
ID: customscript_refreshcache
Recalc Function: RefreshCache
Script File:
function RefreshCache()
{
window.location.reload(true);
}

2. No need to deploy Client SuiteScript since this will be called by the button generated by the User Event Script

3. Create a User Event Script (Customization > Scripts > Workflows > New > User Event)
Name: Button Cache
Before Load Function: beforeLoadScript
Script File:
function beforeLoadScript(type, form, request)
{
form.setScript('customscript_refreshcache'); //reference the Client SuiteScript
form.addButton('custpage_clearthatcache', 'Refresh Cache', 'RefreshCache()' ); //add button
}

4. Deploy SuiteScript to the record desired (Deploy Script button)
Applies To: -any-
Roles: -any role you wish to apply the customization-

No comments:

Post a Comment