Aly
04/10/2025, 3:08 PMCeligo AI
04/10/2025, 3:08 PMAI generated answer (using internal Slack threads):The best way to display a soft alert box through a user event script when a user tries to save the record but the condition is not met is to use a combination of User Event and Client scripts. In your User Event script, you can include a Client Script in the
beforeLoad()
function. Here is a sample code snippet:
javascript
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 an HTML field to display the warning message. You can make the default value of the inlineHTML something like <div id="fill_this_in_on_page_load"></div>
, and then your client script would have something like jQuery('#fill_this_in_on_page_load').html('here is my fancy HTML');
.
Alternatively, you can use the N/ui/message
module to display your message as a banner. Here is a sample code snippet:
javascript
var message = message.create({
type: message.Type.WARNING,
title: "Warning",
message: "Your warning message here"
});
message.show();
Remember to return false
in the saveRecord
function of your Client Script if the condition is not met. This will prevent the record from being saved.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
04/10/2025, 3:09 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.839948416
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.839697778
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.838819265
Celigo AI
04/10/2025, 3:09 PM