Running client script in view mode

Running client script in view mode

In order to run clientscript in view mode you need to modify the form on BeforeLoad using a UserEvent script and attach a Clientscript file to the form using clientScriptFieldId function. Here’s some examples on how to do it:

 

Suitescript 1.0:

Here’s what you would have in your 1.0 Clientscript customscript_yourscriptid file:

Note: The Clientscript record doesn’t need to be deployed, you don’t need to fill the function names either. As long as it exists the logic will run.

Suitescript 2.0:

Here’s what you would have in your 2.0 Clientscript file:

Suitescript 2.0 InlineHTML Hack:

If you need to run your code without having to click a button you can try the the following code. This code injects a script into the form to hack the DOM. In other words it’s a hack.

The following code is a hack. Use carefully.