Hi, creating a userevent script but I would like a...
# suitescript
g
Hi, creating a userevent script but I would like a popup based on specific conditions. Cannot make it a client script as they dont support n/https. any advise?
b
Be more specific. What condition? What kind of popup (alert,new window,toast notification)
Your N/https limitation sounds strange, client script supports it
c
You can play around with injecting HTML into a hidden field that’s added beforeLoad,
Copy code
var objBanner = JSON.parse(stDisplayBanner);
						stInjectHtml = 'var myMessage = message.create({title: \'' + objBanner.title + '\', message: \'' + objBanner.message + '\', type: message.Type.' + objBanner.type + '});';
						stInjectHtml += 'myMessage.show({duration: ' + objBanner.duration + '});';
						objInjectionField.defaultValue = '<script>jQuery(function($) {require([\'N/ui/message\'], function(message){' + stInjectHtml + ';})})</script>';
						record.submitFields({
							type: 'customrecord_fa_asset',
							id: objAsset.id,
							values: {'custrecord_fa_ast_display_banner': ''},
							options: {enableSourcing: false, ignoreMandatoryFields: true}
						});
c
Serverside does not support popups because its serverside. The validation should be done prior to making a call or if not available, store the return values and do some kind of alert with that client side.
z
https is fully supported on the clientside... Promise also is. supported
g
Thanks, and Encode is also supported? Figured out HTTP error was s/t else.
b
N/encode isnt supported client side, but there are plenty of normal javascript libraries that will probably do what you want