1

I'm working with a custom record in NetSuite and I want to display a green message.create() confirmation message when the record is viewed, but only if the URL contains the parameter isProcessed=true.

I want to show a green NetSuite-style confirmation message for 4 seconds in VIEW mode of a custom record if &isProcessed=true is in the URL.

I tried using a Client Script with pageInit(), but it doesn’t run in VIEW mode.

I also tried injecting a <script> tag via inlinehtml field in a User Event Script — but the script either gets ignored or doesn't run in time.

Is there any other way of doing it or its a limitation? When does this message.create actually works?

1 Answer 1

4

EDIT: SuiteScript 2.1 does support 'N/ui/message' module in UserEvent Script beforeLoad function

You can use UserEvent Script beforeLoad function there you can fetch the parameters from URL and show the Message as well.

See below working Snippet:

const beforeLoad = (scriptContext) => {
            const isProcessed = scriptContext.request.parameters.isProcessed;
            log.debug("isProcessed",isProcessed);
            if(scriptContext.type === 'view' && isProcessed == 'T'){
                scriptContext.form.addPageInitMessage({
                    type: message.Type.CONFIRMATION,
                    message: 'This is a message in view mode',
                    duration: 7000
                });
        
            }
        }
Sign up to request clarification or add additional context in comments.

1 Comment

Hi, did the above answer resolve your issue?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.