Hi, is there anyone who would guide me please on c...
# suitescript
j
Hi, is there anyone who would guide me please on creating a user event script which would display a warning (like this in screenshot) on a customer record based if some values are filled or not? In my approach I have a field (type inline html) on customer form and disabled by default. Then in user event script I have a condition in beforeload function if it's type view/edit then display that field and set default value as html. Should I also include those insctructions in beforeSubmit / afterSubmit? As I have it only in before load but that I guess causing weird behaviour when script is deployed and released. Has anyone already have something like that implemented and works well to display messages at the top of the page? Thanks a lot for any feedback/suggestions.
j
In your UE script
beforeLoad()
function, include a Client Script using something like this:
if(runtime.executionContext == runtime.ContextType.USER_INTERFACE) context.form.clientScriptModulePath = ‘path/to/your/client/script’;
then in your Client Script you can adjust the content of that HTML field
I’ve used this method where I make the default value of the inlineHTML something like
<div id="fill_this_in_on_page_load"></div>
and then my client script would have something like jQuery(‘#fill_this_in_on_page_load’).html(‘here is my fancy HTML’);
it’s hacky but it works
b
j
Yep that’s a better solution if you don’t have a requirement to show it exactly as in @Jan Krejcik’s screenshot
j
Thank you @jen and @battk for the tips! I will give it a try 😉