using a client side suitescript, can I display a m...
# ask-stanley-ai
a
using a client side suitescript, can I display a message when a function is called and hide the message when the fuction is finished executing?
c
AI generated answer (using internal Slack threads):
Yes, you can display a message when a function is called and hide the message when the function is finished executing using a client-side SuiteScript. Here's a general approach based on the conversations: 1. Create a message using the
N/ui/message
module. This message can be displayed when the function is called.
Copy code
javascript
var myMsg = message.create({
    title: "Processing", 
    message: "Function is executing...", 
    type: message.Type.INFORMATION
});
myMsg.show();
2. Call your function. If it's an asynchronous operation, consider using Promises or async/await to handle the asynchronous nature of the operation. 3. Once the function has finished executing, hide the message.
Copy code
javascript
myMsg.hide();
In the context of a Suitelet, you can use the
Form.addPageInitMessage()
method to display a message when the page is initialized. If you need to call a non-entry point client function from a Suitelet context, you can add a hidden field to be toggled from the Suitelet and use the
pageInit
function. Alternatively, you can move the function to its own module, then include the module in the entry points. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.848190844
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.842383504
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840986431
Please provide your feedback on this answer.